This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
There is a -Wenum-compare warning in gcc/c-family/array-notation-common.c
- From: Chung-Ju Wu <jasonwucj at gmail dot com>
- To: "Balaji V. Iyer" <balaji dot v dot iyer at intel dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 16 Jun 2013 09:23:04 +0800
- Subject: There is a -Wenum-compare warning in gcc/c-family/array-notation-common.c
Hi Balaji,
I was building a native gcc with trunk r200117,
but I noticed the following code fragment cause -Wenum-compare warning:
[gcc/c-family/array-notation-common.c]
483 /* This function is used by C and C++ front-ends. In C++, additional
484 tree codes such as TARGET_EXPR must be eliminated. These codes are
485 passed into additional_tcodes and are walked through and checked. */
486 for (ii = 0; ii < vec_safe_length (i_list->additional_tcodes); ii++)
487 if (TREE_CODE (*tp) == (enum rid)(*(i_list->additional_tcodes))[ii])
488 *walk_subtrees = 0;
/gcc-4.9.0/gcc/c-family/array-notation-common.c: In function
'tree_node* find_inv_trees(tree_node**, int*, void*)':
/gcc-4.9.0/gcc/c-family/array-notation-common.c:487:68: warning:
comparison between 'enum tree_code' and 'enum rid' [-Wenum-compare]
if (TREE_CODE (*tp) == (enum rid)(*(i_list->additional_tcodes))[ii])
^
Seem that you are comparing different enum type.
Is this intentional? Or are there some typo or some logic error
for this piece of code?
Best regards,
jasonwucj