This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Tree checking failure in C++
- To: kenner at vlsi1 dot ultra dot nyu dot edu
- Subject: Re: PATCH: Tree checking failure in C++
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 24 Oct 2000 08:20:44 -0700
- Cc: aph at cygnus dot co dot uk, gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <10010241322.AA12094@vlsi1.ultra.nyu.edu>
>>>>> "Richard" == Richard Kenner <kenner@vlsi1.ultra.nyu.edu> writes:
Richard> + /* Don't crash if the comparison was erroneous. */ +
Richard> if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) ==
Richard> ERROR_MARK) + return const0_rtx;
Richard> Sometimes the test is done this way, but sometimes it's
Richard> done as a comparison with error_mark_node. We should
Richard> standardize on one of them. My vote is for this one
Richard> since I think it's clearer.
Actually, I think there's a pretty clear existing preference for using
`error_mark_node'.
(The last time we had a debate like this, where there was no clear
answer, I promised the SC to make a decision by looking at existing
practice.)
I know it's a coarse measure, but:
bash$ find . -name '*.c' -o -name '*.h' |
xargs -n10 grep 'CODE.*==.*ERROR_MARK' | wc -l
303
bash$ find . -name '*.c' -o -name '*.h' |
xargs -n10 grep '==.*error_mark_node' | wc -l
554
And, of the ERROR_MARK cases, most are in the chill directory.
Finally, the `error_mark_node' test is perhaps better in two ways:
- It's probably faster, since it doesn't involve any data access.
- It reminds us that there is supposed to be only one node with
ERROR_MARK set, ever.
- Finally, since ERROR_MARK tends to be zero, lots of random
storage ends up looking like an ERROR_MARK, which can mask
real errors. Using error_mark_node makes it easier to find
those errors.
So, let's use the `error_mark_node' form instead.
With that change, the patch is fine.
Thanks,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com