This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]