Re: Why is this expression detected as undefined by GCC, Splint?
- From: amuro <amuro.june@xxxxxxxxx>
- Date: Thu, 30 Dec 2010 06:43:58 -0800 (PST)
On 12월30일, 오후10시18분, Eric Sosman <esos...@xxxxxxxxxxxxxxxxxxxx> wrote:
On 12/30/2010 1:50 AM, amuro wrote:
Hi, I wonder why the following expression is detected as undefined
expression. In my opinion, this is a "defined" expression.
x = *(x++, p); // line 21
Undefined behavior: `x' is modified twice without an intervening
sequence point.
Yes, there's a sequence point between `x++' and `p'. But there's
no sequence point between `x=' and `x++'.
[about x = *(x++, p);]
I think it can be derived that there exists sequence point between
`x=`(assignment) and side effect generated by 'x++' with respect to
all the possible(acceptable) evaluation sequences.
* "a > b" means that b is sequenced before a
'x=' > value computation of LHS and RHS of x= which requires
"evaluating p" // by 6.5.16p3
"evaluating p" > side effect by x+
+ // by comma op
Therefore.. 'x=' is sequenced before side effect of x++.
IOW, there's a sequence point between 'x=' and 'x++'..
.
- Follow-Ups:
- Re: Why is this expression detected as undefined by GCC, Splint?
- From: Eric Sosman
- Re: Why is this expression detected as undefined by GCC, Splint?
- References:
- Why is this expression detected as undefined by GCC, Splint?
- From: amuro
- Re: Why is this expression detected as undefined by GCC, Splint?
- From: Eric Sosman
- Why is this expression detected as undefined by GCC, Splint?
- Prev by Date: Re: Integer Overflow
- Next by Date: Re: Integer Overflow
- Previous by thread: Re: Why is this expression detected as undefined by GCC, Splint?
- Next by thread: Re: Why is this expression detected as undefined by GCC, Splint?
- Index(es):
Relevant Pages
|