cc0 that is built by g++ 4.8.2 can not passes the correctness tests.
However, cc0 built by g++ 4.4.4 can pass the tests.
In the cc0 source code, there are places uses char *p like this:
char *p
*p++ = *p | 0x1;
The sequence of operations (p++, and *p) is ambiguous. Check a discussion at: http://pic.dhe.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ibm.ztpf-ztpfdf.doc_put.cur%2Fcommon%2Fm1rhoseq.html and also http://en.cppreference.com/w/cpp/language/eval_order .
To fix it, I changed code above to:
char _p = *p; *p++ = _p | 0x1;
to force (*p) to be evaluated first.
Log in to post a comment.
In the cc0 source code, there are places uses
char *p
like this:The sequence of operations (p++, and *p) is ambiguous. Check a discussion at: http://pic.dhe.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ibm.ztpf-ztpfdf.doc_put.cur%2Fcommon%2Fm1rhoseq.html and also http://en.cppreference.com/w/cpp/language/eval_order .
To fix it, I changed code above to:
to force (*p) to be evaluated first.
Last edit: Eric Zhiqiang Ma 2013-12-26