Summary: | C comma operator: wrong behavior | ||
---|---|---|---|
Product: | gcc | Reporter: | suan |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | gcc-bugs, jsm28 |
Priority: | P3 | Keywords: | wrong-code |
Version: | 3.0.3 | ||
Target Milestone: | --- | ||
Host: | i686-pc-linux-gnu | Target: | i686-pc-linux-gnu |
Build: | i686-pc-linux-gnu | Known to work: | |
Known to fail: | Last reconfirmed: |
Description
suan
2002-04-22 10:06:01 UTC
Fix: Don't know. State-Changed-From-To: open->closed State-Changed-Why: Sequence points define a partial ordering, not a total ordering. There is no ordering in the example between (val=11) and any part of the other argument of +. Both arguments of the comma operator conflict with (val=11), causing undefined behavior if this code is ever executed (so the compiler can make deductions on the basis that it never will be executed). Reopening to .... Hmm... now that I've been reminded of this bug, I might as well try to revive it. I think my question has more to do with the granularity of well-defined-ness. Consider the expression A + (B,C), which contains a subexpression (B,C) which is itself an expression. If the expression (B,C) does not contain conflicts, should not its behavior be well-defined? Should not the A-B/A-C conflict in the outer expression mean only that the outer expression's behavior be undefined, and not affect the well-defined-ness of the inner expression? |