I accidently was comparing the id rather than identifier of the
possible values.  This does not cause any issue currently as there
was no use of CONVERT_EXPR/NOP_EXPR as one of the possible values.

Pushed as obvious after bootstrap/test on x86_64-linux-gnu.

        PR middle-end/127308

gcc/ChangeLog:

        * genmatch.cc (operator==): Move earlier.
        (c_code_id::gen_checking):  Correct the check for CONVERT_EXPR/NOP_EXPR.

Signed-off-by: Andrea Pinski <[email protected]>
---
 gcc/genmatch.cc | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index d5d5eb3dbe2..42a04436c57 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -1184,6 +1184,18 @@ public:
   const char *tcc;
 };
 
+/* Helper for easy comparing ID with tree code CODE.  */
+
+static bool
+operator==(id_base &id, enum tree_code code)
+{
+  if (operator_id *oid = dyn_cast <operator_id *> (&id))
+    return oid->code == code;
+  return false;
+}
+
+/* Lookup the identifier ID.  Allow "null" if ALLOW_NULL.  */
+
 /* Identifier that maps to a builtin or internal function code.  */
 
 class fn_id : public id_base
@@ -1276,7 +1288,7 @@ c_code_id::gen_checking (FILE *f, int indent)
     {
       if (t == 0)
        fprint_indent (f, indent);
-      if (*id == CONVERT_EXPR || *id == NOP_EXPR)
+      if (*i == CONVERT_EXPR || *i == NOP_EXPR)
        fprintf (f, "CASE_CONVERT:");
       else
        fprintf (f, "case %s:", i->id);
@@ -1486,18 +1498,6 @@ add_function (T code, const char *id)
   *slot = fn;
 }
 
-/* Helper for easy comparing ID with tree code CODE.  */
-
-static bool
-operator==(id_base &id, enum tree_code code)
-{
-  if (operator_id *oid = dyn_cast <operator_id *> (&id))
-    return oid->code == code;
-  return false;
-}
-
-/* Lookup the identifier ID.  Allow "null" if ALLOW_NULL.  */
-
 id_base *
 get_operator (const char *id, bool allow_null = false)
 {
-- 
2.43.0

Reply via email to