A
amuro
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
$ gcc -Wsequence-point test.c
test.1:21: warning: operation on 'x' may be undefined
$ splint test.c
test.c:21:6: Expression has undefined behavior (value of left operand
x is modified by right operand *(x++, p)): x = *(x++, p)
Another expression looks similar with previous expression shows
expected result by GCC but not Splint. That means GCC does not
consider it as undefined but Splint considers it as undefined
expression.
x = (x++, y); // line 19
$ splint test.c
test.c:19:6: Expression has undefined behavior (value of left operand
x is modified by right operand (x++, y)): x = (x++, y)
Thx in advance.
expression. In my opinion, this is a "defined" expression.
x = *(x++, p); // line 21
$ gcc -Wsequence-point test.c
test.1:21: warning: operation on 'x' may be undefined
$ splint test.c
test.c:21:6: Expression has undefined behavior (value of left operand
x is modified by right operand *(x++, p)): x = *(x++, p)
Another expression looks similar with previous expression shows
expected result by GCC but not Splint. That means GCC does not
consider it as undefined but Splint considers it as undefined
expression.
x = (x++, y); // line 19
$ splint test.c
test.c:19:6: Expression has undefined behavior (value of left operand
x is modified by right operand (x++, y)): x = (x++, y)
Thx in advance.