This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12566] ugly ERROR_MARK use
- From: "carlo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Oct 2003 01:06:52 -0000
- Subject: [Bug c++/12566] ugly ERROR_MARK use
- References: <20031010084234.12566.nathan@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12566
------- Additional Comments From carlo at gcc dot gnu dot org 2003-10-12 01:06 -------
On the topic of ugly ERROR_MARK usage,
are you aware of the fact that C_EXP_ORIGINAL_CODE,
defined in c-common.h, is used to (sometimes) read
the value of tree_exp::complexity of expressions
that never use (or explicitely set) C_EXP_ORIGINAL_CODE?
The result is that the value returned by C_EXP_ORIGINAL_CODE
for those expressions, which is 0 as a result of the
memset() in make_node(), is interpreted as ERROR_MARK,
which coincidently has value 0 too.
In most cases this results in an boolean expression
to evaluate to false, like in:
if (C_EXP_ORIGINAL_CODE(exp) == PLUS_EXPR)
but a for example in parser_build_binary_op() it is
indirectly also used as array index, doing something
like:
code1 = C_EXP_ORIGINAL_CODE (arg1);
[...]
use TREE_CODE_CLASS (code1)
I ran into this when I tried to use the apparently by
most expression types unused 'complexity' element for
something else.