This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

PATCH RFC: Fix enum comparisons


I wrote a patch to support -Wenum-compare in C.  This is useful for
gcc-in-cxx because -Wenum-compare is the default in C++.  Supporting
-Wenum-compare in C will make it easier to make gcc code C++
compliant.

Unfortunately, since we are in stage 3, that patch is not appropriate
to apply now.  However, bootstrapping with the patch found several
minor bugs in the gcc source code.  Those changes, being bugs, are
appropriate for stage 3.

The first attachment below is the -Wenum-compare support.  I don't
propose to apply that patch now, but I would be interested in any
comments from the C frontend maintainers.  I have not yet updated the
documentation; basically, -Wenum-compare is the default in C++, and in
C it is enabled by -Wall or -Wc++-compat.

The second attachment below is the changes to gcc to permit it to
bootstrap when the first patch is applied.  I plan to apply that
patch, with the following ChangeLog entry.

Fortran maintainers: as I noted yesterday, the code in
check_assumed_size_reference is wrong.  The patch below makes the code
equivalent to what it was before, in that it compares against an enum
of the right type with the same value.  I don't know how to fix this
correctly.  If you like, I will simply omit that part of that patch
when I commit.

Ian


gcc/ChangeLog:
2008-09-03  Ian Lance Taylor  <iant@google.com>

	* rtl.h (LABEL_REF_NONLOCAL_P): Don't check for REG_LABEL_OPERAND
	or REG_LABEL_TARGET.
	* calls.c (emit_library_call_value_1): Use MEM_P rather than
	comparing MODE with MEM.
	* gimple.c (gimple_build_predict): Cast END_PREDICTORS before
	comparing with GF_PREDICT_TAKEN.
	(gimple_get_lhs): Change code to enum gimple_code.
	(gimple_set_lhs): Likewise.
	* ifcvt.c (noce_process_if_block): Correct GET_MODE to GET_CODE.
	* omp-low.c (find_omp_clause): Change kind parameter to enum
	omp_clause_code.
	* tree-flow.h (find_omp_clause): Update declaration.
	* regrename.c (clear_dead_regs): Change kind parameter to enum
	reg_note.
	* reload1.c (eliminate_regs_1): Use REG_NOTE_KIND rather than
	GET_MODE.
	* see.c (see_get_extension_data): Change return type to enum
	entry_type.  Change UNKNOWN to NOT_RELEVANT, SIGN_EXTEND to
	SIGNED_EXTENDED_DEF, ZERO_EXTEND to ZERO_EXTENDED_DEF.
	(see_gen_normalized_extension): Change extension_code parameter to
	enum entry_type.
	(see_seek_pre_extension_expr): Change extension_code to enum
	entry_type.
	(see_merge_one_def_extension): Likewise.
	(see_handle_relevant_defs): Likewise.
	(see_handle_relevant_uses): Likewise.
	(see_analyze_one_def): Likewise.
	* tree-cfg.c (need_fake_edge_p): Compare gimple code with
	GIMPLE_ASM rather than ASM_EXPR.
	* tree-ssa-alias.c (is_escape_site): Compare gimple code with
	GIMPLE_RETURN rather than RETURN_EXPR.
	* tree-ssa-ccp.c (likely_value): Change code to enum gimple_code.
	(evaluate_stmt): Likewise.
	* tree-vect-analyze.c (vect_analyze_operations): Change relevance
	to enum vect_relevant.
	(vect_mark_stmts_to_be_vectorized): Change assertion to not
	compare gimple codes with tree codes.

gcc/cp/ChangeLog:
2008-09-03  Ian Lance Taylor  <iant@google.com>

	* parser.c (check_no_duplicate_clause): Change code parameter to
	enum omp_clause_code.

gcc/fortran/ChangeLog:
2008-09-03  Ian Lance Taylor  <iant@google.com>

	* symbol.c (generate_isocbinding_symbol): Compare
	gfc_notification_std with ERROR rather than FAILURE.
	* resolve.c (check_assumed_size_reference): Compare array type
	with AR_FULL rather than DIMEN_ELEMENT.
	(resolve_actual_arglist): Compare with EXPR_VARIABLE rather than
	FL_VARIABLE.


-Wenum-compare support:

Index: gcc/c.opt
===================================================================
--- gcc/c.opt	(revision 139906)
+++ gcc/c.opt	(working copy)
@@ -196,7 +196,7 @@
 Warn about stray tokens after #elif and #endif
 
 Wenum-compare
-C++ ObjC++ Var(warn_enum_compare) Init(1) Warning
+C ObjC C++ ObjC++ Var(warn_enum_compare) Init(-1) Warning
 Warn about comparison of different enum types
 
 Werror
Index: gcc/c-opts.c
===================================================================
--- gcc/c-opts.c	(revision 139906)
+++ gcc/c-opts.c	(working copy)
@@ -409,6 +409,11 @@
 	     can turn it off only if it's not explicit.  */
 	  if (warn_main == -1)
 	    warn_main = (value ? 2 : 0);
+
+	  /* In C, -Wall turns on -Wenum-compare, which we do here.
+	     In C++ it is on by default, which is done in
+	     c_common_post_options.  */
+	  warn_enum_compare = value;
 	}
       else
 	{
@@ -431,6 +436,13 @@
       cpp_opts->warn_comments = value;
       break;
 
+    case OPT_Wc___compat:
+      /* Because -Wenum-compare is the default in C++, -Wc++-compat
+	 implies -Wenum-compare.  */
+      if (warn_enum_compare == -1 && value)
+	warn_enum_compare = value;
+      break;
+
     case OPT_Wdeprecated:
       cpp_opts->warn_deprecated = value;
       break;
@@ -1081,6 +1093,11 @@
   if (warn_sign_conversion == -1)
     warn_sign_conversion =  (c_dialect_cxx ()) ? 0 : warn_conversion;
 
+  /* In C, -Wall and -Wc++-compat enable -Wenum-compare, which we do
+     in c_common_handle_option; if it has not yet been set, it is
+     disabled by default.  In C++, it is enabled by default.  */
+  if (warn_enum_compare == -1)
+    warn_enum_compare = c_dialect_cxx () ? 1 : 0;
 
   /* Special format checking options don't work without -Wformat; warn if
      they are used.  */
Index: gcc/c-tree.h
===================================================================
--- gcc/c-tree.h	(revision 139906)
+++ gcc/c-tree.h	(working copy)
@@ -156,6 +156,11 @@
      constants, or ERROR_MARK for other expressions (including
      parenthesized expressions).  */
   enum tree_code original_code;
+  /* If not NULL, the original type of an expression.  This will
+     differ from the type of value for an enum constant.  The type of
+     an enum constant is a plain integer type, but this field will be
+     the enum type.  */
+  tree original_type;
 };
 
 /* A kind of type specifier.  Note that this information is currently
@@ -551,7 +556,7 @@
 extern tree composite_type (tree, tree);
 extern tree build_component_ref (tree, tree);
 extern tree build_array_ref (tree, tree, location_t);
-extern tree build_external_ref (tree, int, location_t);
+extern tree build_external_ref (tree, int, location_t, tree *);
 extern void pop_maybe_used (bool);
 extern struct c_expr c_expr_sizeof_expr (struct c_expr);
 extern struct c_expr c_expr_sizeof_type (struct c_type_name *);
Index: gcc/c-parser.c
===================================================================
--- gcc/c-parser.c	(revision 139906)
+++ gcc/c-parser.c	(working copy)
@@ -3035,6 +3035,7 @@
       struct c_expr ret;
       ret.value = error_mark_node;
       ret.original_code = ERROR_MARK;
+      ret.original_type = NULL;
       c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, "expected %<}%>");
       return ret;
     }
@@ -3090,6 +3091,7 @@
 		  struct c_expr init;
 		  init.value = error_mark_node;
 		  init.original_code = ERROR_MARK;
+                  init.original_type = NULL;
 		  c_parser_error (parser, "expected identifier");
 		  c_parser_skip_until_found (parser, CPP_COMMA, NULL);
 		  process_init_element (init);
@@ -3164,6 +3166,7 @@
 		  mexpr.value
 		    = objc_build_message_expr (build_tree_list (rec, args));
 		  mexpr.original_code = ERROR_MARK;
+                  mexpr.original_type = NULL;
 		  /* Now parse and process the remainder of the
 		     initializer, starting with this message
 		     expression as a primary-expression.  */
@@ -3213,6 +3216,7 @@
 		  struct c_expr init;
 		  init.value = error_mark_node;
 		  init.original_code = ERROR_MARK;
+                  init.original_type = NULL;
 		  c_parser_error (parser, "expected %<=%>");
 		  c_parser_skip_until_found (parser, CPP_COMMA, NULL);
 		  process_init_element (init);
@@ -4405,6 +4409,7 @@
       TREE_NO_WARNING (ret.value) = 1;
       ret.original_code = ERROR_MARK;
     }
+  ret.original_type = NULL;
   return ret;
 }
 
@@ -4456,6 +4461,7 @@
       skip_evaluation -= cond.value == truthvalue_true_node;
       ret.value = error_mark_node;
       ret.original_code = ERROR_MARK;
+      ret.original_type = NULL;
       return ret;
     }
   exp2 = c_parser_conditional_expression (parser, NULL);
@@ -4463,6 +4469,7 @@
   skip_evaluation -= cond.value == truthvalue_true_node;
   ret.value = build_conditional_expr (cond.value, exp1.value, exp2.value);
   ret.original_code = ERROR_MARK;
+  ret.original_type = NULL;
   return ret;
 }
 
@@ -4747,6 +4754,7 @@
 	{
 	  ret.value = error_mark_node;
 	  ret.original_code = ERROR_MARK;
+          ret.original_type = NULL;
 	  return ret;
 	}
 
@@ -4760,6 +4768,7 @@
       expr = default_function_array_conversion (expr);
       ret.value = c_cast_expr (type_name, expr.value);
       ret.original_code = ERROR_MARK;
+      ret.original_type = NULL;
       return ret;
     }
   else
@@ -4799,6 +4808,8 @@
   int ext;
   struct c_expr ret, op;
   location_t loc = c_parser_peek_token (parser)->location;
+  ret.original_code = ERROR_MARK;
+  ret.original_type = NULL;
   switch (c_parser_peek_token (parser)->type)
     {
     case CPP_PLUS_PLUS:
@@ -4821,7 +4832,6 @@
       op = c_parser_cast_expression (parser, NULL);
       op = default_function_array_conversion (op);
       ret.value = build_indirect_ref (op.value, "unary *", loc);
-      ret.original_code = ERROR_MARK;
       return ret;
     case CPP_PLUS:
       if (!c_dialect_objc () && !in_system_header)
@@ -4861,7 +4871,6 @@
 	  c_parser_error (parser, "expected identifier");
 	  ret.value = error_mark_node;
 	}
-	ret.original_code = ERROR_MARK;
 	return ret;
     case CPP_KEYWORD:
       switch (c_parser_peek_token (parser)->keyword)
@@ -4922,6 +4931,7 @@
 	  in_sizeof--;
 	  ret.value = error_mark_node;
 	  ret.original_code = ERROR_MARK;
+          ret.original_type = NULL;
 	  return ret;
 	}
       if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
@@ -4983,6 +4993,7 @@
 	  in_alignof--;
 	  ret.value = error_mark_node;
 	  ret.original_code = ERROR_MARK;
+          ret.original_type = NULL;
 	  return ret;
 	}
       if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
@@ -4996,6 +5007,7 @@
       in_alignof--;
       ret.value = c_alignof (groktypename (type_name));
       ret.original_code = ERROR_MARK;
+      ret.original_type = NULL;
       return ret;
     }
   else
@@ -5007,6 +5019,7 @@
       in_alignof--;
       ret.value = c_alignof_expr (expr.value);
       ret.original_code = ERROR_MARK;
+      ret.original_type = NULL;
       return ret;
     }
 }
@@ -5070,6 +5083,8 @@
   struct c_expr expr, e1, e2, e3;
   struct c_type_name *t1, *t2;
   location_t loc;
+  expr.original_code = ERROR_MARK;
+  expr.original_type = NULL;
   switch (c_parser_peek_token (parser)->type)
     {
     case CPP_NUMBER:
@@ -5078,7 +5093,6 @@
     case CPP_CHAR32:
     case CPP_WCHAR:
       expr.value = c_parser_peek_token (parser)->value;
-      expr.original_code = ERROR_MARK;
       c_parser_consume_token (parser);
       break;
     case CPP_STRING:
@@ -5093,7 +5107,6 @@
       gcc_assert (c_dialect_objc ());
       expr.value
 	= objc_build_string_object (c_parser_peek_token (parser)->value);
-      expr.original_code = ERROR_MARK;
       c_parser_consume_token (parser);
       break;
     case CPP_NAME:
@@ -5101,7 +5114,6 @@
 	{
 	  c_parser_error (parser, "expected expression");
 	  expr.value = error_mark_node;
-	  expr.original_code = ERROR_MARK;
 	  break;
 	}
       {
@@ -5110,8 +5122,8 @@
 	c_parser_consume_token (parser);
 	expr.value = build_external_ref (id,
 					 (c_parser_peek_token (parser)->type
-					  == CPP_OPEN_PAREN), loc);
-	expr.original_code = ERROR_MARK;
+					  == CPP_OPEN_PAREN), loc,
+					 &expr.original_type);
       }
       break;
     case CPP_OPEN_PAREN:
@@ -5132,7 +5144,6 @@
 	      c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, NULL);
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  stmt = c_begin_stmt_expr ();
@@ -5142,7 +5153,6 @@
 	  pedwarn (here, OPT_pedantic, 
 		   "ISO C forbids braced-groups within expressions");
 	  expr.value = c_finish_stmt_expr (stmt);
-	  expr.original_code = ERROR_MARK;
 	}
       else if (c_token_starts_typename (c_parser_peek_2nd_token (parser)))
 	{
@@ -5158,7 +5168,6 @@
 	  if (type_name == NULL)
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	    }
 	  else
 	    expr = c_parser_postfix_expression_after_paren_type (parser,
@@ -5171,7 +5180,8 @@
 	  expr = c_parser_expression (parser);
 	  if (TREE_CODE (expr.value) == MODIFY_EXPR)
 	    TREE_NO_WARNING (expr.value) = 1;
-	  expr.original_code = ERROR_MARK;
+          expr.original_code = ERROR_MARK;
+          expr.original_type = NULL;
 	  c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
 				     "expected %<)%>");
 	}
@@ -5184,7 +5194,6 @@
 	case RID_C99_FUNCTION_NAME:
 	  expr.value = fname_decl (c_parser_peek_token (parser)->keyword,
 				   c_parser_peek_token (parser)->value);
-	  expr.original_code = ERROR_MARK;
 	  c_parser_consume_token (parser);
 	  break;
 	case RID_VA_ARG:
@@ -5192,7 +5201,6 @@
 	  if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  e1 = c_parser_expr_no_commas (parser, NULL);
@@ -5200,7 +5208,6 @@
 	    {
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  t1 = c_parser_type_name (parser);
@@ -5209,12 +5216,10 @@
 	  if (t1 == NULL)
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	    }
 	  else
 	    {
 	      expr.value = build_va_arg (e1.value, groktypename (t1));
-	      expr.original_code = ERROR_MARK;
 	    }
 	  break;
 	case RID_OFFSETOF:
@@ -5222,21 +5227,18 @@
 	  if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  t1 = c_parser_type_name (parser);
 	  if (t1 == NULL)
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  if (!c_parser_require (parser, CPP_COMMA, "expected %<,%>"))
 	    {
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  {
@@ -5289,7 +5291,6 @@
 	    c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
 				       "expected %<)%>");
 	    expr.value = fold_offsetof (offsetof_ref, NULL_TREE);
-	    expr.original_code = ERROR_MARK;
 	  }
 	  break;
 	case RID_CHOOSE_EXPR:
@@ -5297,7 +5298,6 @@
 	  if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  loc = c_parser_peek_token (parser)->location;
@@ -5306,7 +5306,6 @@
 	    {
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  e2 = c_parser_expr_no_commas (parser, NULL);
@@ -5314,7 +5313,6 @@
 	    {
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  e3 = c_parser_expr_no_commas (parser, NULL);
@@ -5335,28 +5333,24 @@
 	  if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  t1 = c_parser_type_name (parser);
 	  if (t1 == NULL)
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  if (!c_parser_require (parser, CPP_COMMA, "expected %<,%>"))
 	    {
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  t2 = c_parser_type_name (parser);
 	  if (t2 == NULL)
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
@@ -5370,7 +5364,6 @@
 	    expr.value = comptypes (e1, e2)
 	      ? build_int_cst (NULL_TREE, 1)
 	      : build_int_cst (NULL_TREE, 0);
-	    expr.original_code = ERROR_MARK;
 	  }
 	  break;
 	case RID_AT_SELECTOR:
@@ -5379,7 +5372,6 @@
 	  if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  {
@@ -5387,7 +5379,6 @@
 	    c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
 				       "expected %<)%>");
 	    expr.value = objc_build_selector_expr (sel);
-	    expr.original_code = ERROR_MARK;
 	  }
 	  break;
 	case RID_AT_PROTOCOL:
@@ -5396,7 +5387,6 @@
 	  if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  if (c_parser_next_token_is_not (parser, CPP_NAME))
@@ -5404,7 +5394,6 @@
 	      c_parser_error (parser, "expected identifier");
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  {
@@ -5413,7 +5402,6 @@
 	    c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
 				       "expected %<)%>");
 	    expr.value = objc_build_protocol_expr (id);
-	    expr.original_code = ERROR_MARK;
 	  }
 	  break;
 	case RID_AT_ENCODE:
@@ -5423,14 +5411,12 @@
 	  if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      break;
 	    }
 	  t1 = c_parser_type_name (parser);
 	  if (t1 == NULL)
 	    {
 	      expr.value = error_mark_node;
-	      expr.original_code = ERROR_MARK;
 	      c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
 	      break;
 	    }
@@ -5439,13 +5425,11 @@
 	  {
 	    tree type = groktypename (t1);
 	    expr.value = objc_build_encode_expr (type);
-	    expr.original_code = ERROR_MARK;
 	  }
 	  break;
 	default:
 	  c_parser_error (parser, "expected expression");
 	  expr.value = error_mark_node;
-	  expr.original_code = ERROR_MARK;
 	  break;
 	}
       break;
@@ -5460,14 +5444,12 @@
 				     "expected %<]%>");
 	  expr.value = objc_build_message_expr (build_tree_list (receiver,
 								 args));
-	  expr.original_code = ERROR_MARK;
 	  break;
 	}
       /* Else fall through to report error.  */
     default:
       c_parser_error (parser, "expected expression");
       expr.value = error_mark_node;
-      expr.original_code = ERROR_MARK;
       break;
     }
   return c_parser_postfix_expression_after_primary (parser, expr);
@@ -5505,6 +5487,7 @@
     pedwarn (start_loc, OPT_pedantic, "ISO C90 forbids compound literals");
   expr.value = build_compound_literal (type, init.value);
   expr.original_code = ERROR_MARK;
+  expr.original_type = NULL;
   return c_parser_postfix_expression_after_primary (parser, expr);
 }
 
@@ -5530,6 +5513,7 @@
 				     "expected %<]%>");
 	  expr.value = build_array_ref (expr.value, idx, loc);
 	  expr.original_code = ERROR_MARK;
+          expr.original_type = NULL;
 	  break;
 	case CPP_OPEN_PAREN:
 	  /* Function call.  */
@@ -5542,6 +5526,7 @@
 				     "expected %<)%>");
 	  expr.value = build_function_call (expr.value, exprlist);
 	  expr.original_code = ERROR_MARK;
+          expr.original_type = NULL;
           if (warn_disallowed_functions)
             warn_if_disallowed_function_p (expr.value);
 	  break;
@@ -5556,11 +5541,13 @@
 	      c_parser_error (parser, "expected identifier");
 	      expr.value = error_mark_node;
 	      expr.original_code = ERROR_MARK;
+              expr.original_type = NULL;
 	      return expr;
 	    }
 	  c_parser_consume_token (parser);
 	  expr.value = build_component_ref (expr.value, ident);
 	  expr.original_code = ERROR_MARK;
+          expr.original_type = NULL;
 	  break;
 	case CPP_DEREF:
 	  /* Structure element reference.  */
@@ -5573,6 +5560,7 @@
 	      c_parser_error (parser, "expected identifier");
 	      expr.value = error_mark_node;
 	      expr.original_code = ERROR_MARK;
+              expr.original_type = NULL;
 	      return expr;
 	    }
 	  c_parser_consume_token (parser);
@@ -5580,6 +5568,7 @@
 								"->", loc),
 					    ident);
 	  expr.original_code = ERROR_MARK;
+          expr.original_type = NULL;
 	  break;
 	case CPP_PLUS_PLUS:
 	  /* Postincrement.  */
@@ -5587,6 +5576,7 @@
 	  expr = default_function_array_conversion (expr);
 	  expr.value = build_unary_op (POSTINCREMENT_EXPR, expr.value, 0);
 	  expr.original_code = ERROR_MARK;
+          expr.original_type = NULL;
 	  break;
 	case CPP_MINUS_MINUS:
 	  /* Postdecrement.  */
@@ -5594,6 +5584,7 @@
 	  expr = default_function_array_conversion (expr);
 	  expr.value = build_unary_op (POSTDECREMENT_EXPR, expr.value, 0);
 	  expr.original_code = ERROR_MARK;
+          expr.original_type = NULL;
 	  break;
 	default:
 	  return expr;
@@ -5621,6 +5612,7 @@
       next = default_function_array_conversion (next);
       expr.value = build_compound_expr (expr.value, next.value);
       expr.original_code = COMPOUND_EXPR;
+      expr.original_type = NULL;
     }
   return expr;
 }
Index: gcc/c-typeck.c
===================================================================
--- gcc/c-typeck.c	(revision 139906)
+++ gcc/c-typeck.c	(working copy)
@@ -2170,9 +2170,11 @@
 
 /* Build an external reference to identifier ID.  FUN indicates
    whether this will be used for a function call.  LOC is the source
-   location of the identifier.  */
+   location of the identifier.  This sets *TYPE to the type of the
+   identifier, which is not the same as the type of the returned value
+   for CONST_DECLs defined as enum constants.  */
 tree
-build_external_ref (tree id, int fun, location_t loc)
+build_external_ref (tree id, int fun, location_t loc, tree *type)
 {
   tree ref;
   tree decl = lookup_name (id);
@@ -2181,8 +2183,12 @@
      whatever lookup_name() found.  */
   decl = objc_lookup_ivar (decl, id);
 
+  *type = NULL;
   if (decl && decl != error_mark_node)
-    ref = decl;
+    {
+      ref = decl;
+      *type = TREE_TYPE (ref);
+    }
   else if (fun)
     /* Implicit function declaration.  */
     ref = implicitly_declare (id);
@@ -2314,12 +2320,14 @@
     {
       ret.value = error_mark_node;
       ret.original_code = ERROR_MARK;
+      ret.original_type = NULL;
       pop_maybe_used (false);
     }
   else
     {
       ret.value = c_sizeof (TREE_TYPE (expr.value));
       ret.original_code = ERROR_MARK;
+      ret.original_type = NULL;
       if (c_vla_type_p (TREE_TYPE (expr.value)))
 	{
 	  /* sizeof is evaluated when given a vla (C99 6.5.3.4p2).  */
@@ -2341,6 +2349,7 @@
   type = groktypename (t);
   ret.value = c_sizeof (type);
   ret.original_code = ERROR_MARK;
+  ret.original_type = NULL;
   pop_maybe_used (type != error_mark_node
 		  ? C_TYPE_VARIABLE_SIZE (type) : false);
   return ret;
@@ -2747,6 +2756,7 @@
   struct c_expr result;
 
   result.original_code = ERROR_MARK;
+  result.original_type = NULL;
   result.value = build_unary_op (code, arg.value, 0);
   protected_set_expr_location (result.value, loc);
 
@@ -2770,9 +2780,16 @@
 
   enum tree_code code1 = arg1.original_code;
   enum tree_code code2 = arg2.original_code;
+  tree type1 = (arg1.original_type
+                ? arg1.original_type
+                : TREE_TYPE (arg1.value));
+  tree type2 = (arg2.original_type
+                ? arg2.original_type
+                : TREE_TYPE (arg2.value));
 
   result.value = build_binary_op (code, arg1.value, arg2.value, 1);
   result.original_code = code;
+  result.original_type = NULL;
 
   if (TREE_CODE (result.value) == ERROR_MARK)
     return result;
@@ -2802,6 +2819,16 @@
       && !TREE_OVERFLOW_P (arg2.value))
     overflow_warning (result.value);
 
+  /* Warn about comparisons of different enum types.  */
+  if (warn_enum_compare
+      && TREE_CODE_CLASS (code) == tcc_comparison
+      && TREE_CODE (type1) == ENUMERAL_TYPE
+      && TREE_CODE (type2) == ENUMERAL_TYPE
+      && TYPE_MAIN_VARIANT (type1) != TYPE_MAIN_VARIANT (type2))
+    warning (OPT_Wenum_compare,
+	     "comparison between %qT and %qT",
+	     type1, type2);
+
   return result;
 }
 
@@ -4748,6 +4775,7 @@
 	  tree typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)));
 	  expr.value = inside_init;
 	  expr.original_code = (strict_string ? STRING_CST : ERROR_MARK);
+          expr.original_type = NULL;
 	  maybe_warn_string_init (type, expr);
 
 	  if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
@@ -5253,6 +5281,7 @@
   p->depth = constructor_depth;
   p->replacement_value.value = 0;
   p->replacement_value.original_code = ERROR_MARK;
+  p->replacement_value.original_type = NULL;
   p->implicit = 0;
   p->range_stack = 0;
   p->outer = 0;
@@ -5394,6 +5423,7 @@
   p->depth = constructor_depth;
   p->replacement_value.value = 0;
   p->replacement_value.original_code = ERROR_MARK;
+  p->replacement_value.original_type = NULL;
   p->implicit = implicit;
   p->outer = 0;
   p->incremental = constructor_incremental;
@@ -5548,6 +5578,7 @@
   struct c_expr ret;
   ret.value = 0;
   ret.original_code = ERROR_MARK;
+  ret.original_type = NULL;
 
   if (implicit == 0)
     {
Index: gcc/testsuite/gcc.dg/Wenum-compare-1.c
===================================================================
--- gcc/testsuite/gcc.dg/Wenum-compare-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/Wenum-compare-1.c	(revision 0)
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wenum-compare" } */
+enum E1 { A, B, C };
+enum E2 { D, E, F };
+extern void f2 ();
+void
+f1 ()
+{
+  int a = A;
+  int d = D;
+  enum E1 e1 = A;
+  enum E2 e2 = D;
+  if (A > D)	/* { dg-warning "comparison between .enum E1. and .enum E2." } */
+    f2 ();
+  if (e1 > e2)  /* { dg-warning "comparison between .enum E1. and .enum E2." } */
+    f2 ();
+  if (e1 > e2 + 1)
+    f2 ();
+  if (A > 0)
+    f2 ();
+  if (e1 > 0)
+    f2 ();
+  if (A + D > 0)
+    f2 ();
+  if (e1 > 0)
+    f2 ();
+  if (A + D > 0)
+    f2 ();
+  if ((int) A > D)
+    f2 ();
+  if ((int) e1 > e2)
+    f2 ();
+}

-Wenum-compare fixes:

Index: gcc/regrename.c
===================================================================
--- gcc/regrename.c	(revision 139906)
+++ gcc/regrename.c	(working copy)
@@ -89,7 +89,7 @@
 static struct du_chain *build_def_use (basic_block);
 static void dump_def_use_chain (struct du_chain *);
 static void note_sets (rtx, const_rtx, void *);
-static void clear_dead_regs (HARD_REG_SET *, enum machine_mode, rtx);
+static void clear_dead_regs (HARD_REG_SET *, enum reg_note, rtx);
 static void merge_overlapping_regs (basic_block, HARD_REG_SET *,
 				    struct du_chain *);
 
@@ -114,7 +114,7 @@
    in the list NOTES.  */
 
 static void
-clear_dead_regs (HARD_REG_SET *pset, enum machine_mode kind, rtx notes)
+clear_dead_regs (HARD_REG_SET *pset, enum reg_note kind, rtx notes)
 {
   rtx note;
   for (note = notes; note; note = XEXP (note, 1))
@@ -1990,4 +1990,3 @@
   TODO_dump_func | TODO_verify_rtl_sharing /* todo_flags_finish */
  }
 };
-
Index: gcc/see.c
===================================================================
--- gcc/see.c	(revision 139906)
+++ gcc/see.c	(working copy)
@@ -712,13 +712,13 @@
     Otherwise, set SOURCE_MODE to be the mode of the extended expr and return
     the rtx code of the extension.  */
 
-static enum rtx_code
+static enum entry_type
 see_get_extension_data (rtx extension, enum machine_mode *source_mode)
 {
   rtx rhs, lhs, set;
 
   if (!extension || !INSN_P (extension))
-    return UNKNOWN;
+    return NOT_RELEVANT;
 
   /* Parallel pattern for extension not supported for the moment.  */
   if (GET_CODE (PATTERN (extension)) == PARALLEL)
@@ -733,21 +733,21 @@
   /* Don't handle extensions to something other then register or
      subregister.  */
   if (!REG_P (lhs) && GET_CODE (lhs) != SUBREG)
-    return UNKNOWN;
+    return NOT_RELEVANT;
 
   if (GET_CODE (rhs) != SIGN_EXTEND && GET_CODE (rhs) != ZERO_EXTEND)
-    return UNKNOWN;
+    return NOT_RELEVANT;
 
   if (!REG_P (XEXP (rhs, 0))
       && !(GET_CODE (XEXP (rhs, 0)) == SUBREG
 	   && REG_P (SUBREG_REG (XEXP (rhs, 0)))))
-    return UNKNOWN;
+    return NOT_RELEVANT;
 
   *source_mode = GET_MODE (XEXP (rhs, 0));
 
   if (GET_CODE (rhs) == SIGN_EXTEND)
-    return SIGN_EXTEND;
-  return ZERO_EXTEND;
+    return SIGN_EXTENDED_DEF;
+  return ZERO_EXTENDED_DEF;
 }
 
 
@@ -760,7 +760,7 @@
    Otherwise, return the generated instruction.  */
 
 static rtx
-see_gen_normalized_extension (rtx reg, enum rtx_code extension_code,
+see_gen_normalized_extension (rtx reg, enum entry_type extension_code,
    			      enum machine_mode mode)
 {
   rtx subreg, insn;
@@ -768,11 +768,12 @@
 
   if (!reg
       || !REG_P (reg)
-      || (extension_code != SIGN_EXTEND && extension_code != ZERO_EXTEND))
+      || (extension_code != SIGN_EXTENDED_DEF
+          && extension_code != ZERO_EXTENDED_DEF))
     return NULL;
 
   subreg = gen_lowpart_SUBREG (mode, reg);
-  if (extension_code == SIGN_EXTEND)
+  if (extension_code == SIGN_EXTENDED_DEF)
     extension = gen_rtx_SIGN_EXTEND (GET_MODE (reg), subreg);
   else
     extension = gen_rtx_ZERO_EXTEND (GET_MODE (reg), subreg);
@@ -1019,14 +1020,14 @@
 {
   struct see_pre_extension_expr **slot_pre_exp, temp_pre_exp;
   rtx dest_extension_reg = see_get_extension_reg (extension, 1);
-  enum rtx_code extension_code;
+  enum entry_type extension_code;
   enum machine_mode source_extension_mode;
 
   if (type == DEF_EXTENSION)
     {
       extension_code = see_get_extension_data (extension,
 					       &source_extension_mode);
-      gcc_assert (extension_code != UNKNOWN);
+      gcc_assert (extension_code != NOT_RELEVANT);
       extension =
 	see_gen_normalized_extension (dest_extension_reg, extension_code,
 				      source_extension_mode);
@@ -2807,7 +2808,7 @@
   rtx simplified_temp_extension = NULL;
   rtx *pat;
   enum rtx_code code;
-  enum rtx_code extension_code;
+  enum entry_type extension_code;
   enum machine_mode source_extension_mode;
   enum machine_mode source_mode = VOIDmode;
   enum machine_mode dest_extension_mode;
@@ -2866,7 +2867,7 @@
 	    {
 	      rtx orig_src = SET_SRC (*sub);
 
-	      if (extension_code == SIGN_EXTEND)
+	      if (extension_code == SIGN_EXTENDED_DEF)
 		temp_extension = gen_rtx_SIGN_EXTEND (dest_extension_mode,
 						      orig_src);
 	      else
@@ -2898,7 +2899,7 @@
     {
       rtx orig_src = SET_SRC (*pat);
 
-      if (extension_code == SIGN_EXTEND)
+      if (extension_code == SIGN_EXTENDED_DEF)
 	temp_extension = gen_rtx_SIGN_EXTEND (dest_extension_mode, orig_src);
       else
 	temp_extension = gen_rtx_ZERO_EXTEND (dest_extension_mode, orig_src);
@@ -3245,7 +3246,7 @@
 {
   struct web_entry *root_entry = NULL;
   rtx se_insn = NULL;
-  enum rtx_code extension_code;
+  enum entry_type extension_code;
   rtx reg = DF_REF_REAL_REG (ref);
   rtx ref_insn = NULL;
   unsigned int i = DF_REF_ID (ref);
@@ -3274,9 +3275,9 @@
     {
       
       if (ENTRY_EI (root_entry)->relevancy == SIGN_EXTENDED_DEF)
-	extension_code = SIGN_EXTEND;
+	extension_code = SIGN_EXTENDED_DEF;
       else
-	extension_code = ZERO_EXTEND;
+	extension_code = ZERO_EXTENDED_DEF;
       
       se_insn =
 	see_gen_normalized_extension (reg, extension_code,
@@ -3314,7 +3315,7 @@
 {
   struct web_entry *root_entry = NULL;
   rtx se_insn = NULL;
-  enum rtx_code extension_code;
+  enum entry_type extension_code;
   rtx reg = DF_REF_REAL_REG (ref);
 
   root_entry = unionfind_root (&use_entry[DF_REF_ID (ref)]);
@@ -3333,9 +3334,9 @@
   
   /* Generate the use extension.  */
   if (ENTRY_EI (root_entry)->relevancy == SIGN_EXTENDED_DEF)
-    extension_code = SIGN_EXTEND;
+    extension_code = SIGN_EXTENDED_DEF;
   else
-    extension_code = ZERO_EXTEND;
+    extension_code = ZERO_EXTENDED_DEF;
   
   se_insn =
     see_gen_normalized_extension (reg, extension_code,
@@ -3468,7 +3469,7 @@
 see_analyze_one_def (rtx insn, enum machine_mode *source_mode,
 		     enum machine_mode *source_mode_unsigned)
 {
-  enum rtx_code extension_code;
+  enum entry_type extension_code;
   rtx rhs = NULL;
   rtx lhs = NULL;
   rtx set = NULL;
@@ -3487,8 +3488,8 @@
   extension_code = see_get_extension_data (insn, source_mode);
   switch (extension_code)
     {
-    case SIGN_EXTEND:
-    case ZERO_EXTEND:
+    case SIGN_EXTENDED_DEF:
+    case ZERO_EXTENDED_DEF:
       source_register = see_get_extension_reg (insn, 0);
       /* FIXME: This restriction can be relaxed.  The only thing that is
 	 important is that the reference would be inside the same basic block
@@ -3521,12 +3522,9 @@
 	    return NOT_RELEVANT;
 	}
 
-      if (extension_code == SIGN_EXTEND)
-	return SIGN_EXTENDED_DEF;
-      else
-	return ZERO_EXTENDED_DEF;
+      return extension_code;
 
-    case UNKNOWN:
+    case NOT_RELEVANT:
       /* This may still be an EXTENDED_DEF.  */
 
       /* FIXME: This restriction can be relaxed.  It is possible to handle
@@ -3894,4 +3892,3 @@
   TODO_dump_func			/* todo_flags_finish */
  }
 };
-
Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c	(revision 139906)
+++ gcc/omp-low.c	(working copy)
@@ -164,7 +164,7 @@
 /* Find an OpenMP clause of type KIND within CLAUSES.  */
 
 tree
-find_omp_clause (tree clauses, enum tree_code kind)
+find_omp_clause (tree clauses, enum omp_clause_code kind)
 {
   for (; clauses ; clauses = OMP_CLAUSE_CHAIN (clauses))
     if (OMP_CLAUSE_CODE (clauses) == kind)
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 139906)
+++ gcc/cp/parser.c	(working copy)
@@ -20039,7 +20039,7 @@
 /* Validate that a clause of the given type does not already exist.  */
 
 static void
-check_no_duplicate_clause (tree clauses, enum tree_code code,
+check_no_duplicate_clause (tree clauses, enum omp_clause_code code,
 			   const char *name, location_t location)
 {
   tree c;
Index: gcc/tree-ssa-ccp.c
===================================================================
--- gcc/tree-ssa-ccp.c	(revision 139906)
+++ gcc/tree-ssa-ccp.c	(working copy)
@@ -501,7 +501,7 @@
   tree use;
   ssa_op_iter iter;
 
-  enum tree_code code = gimple_code (stmt);
+  enum gimple_code code = gimple_code (stmt);
 
   /* This function appears to be called only for assignments, calls,
      conditionals, and switches, due to the logic in visit_stmt.  */
@@ -1308,7 +1308,7 @@
      bother folding the statement.  */
   else if (likelyvalue == VARYING)
     {
-      enum tree_code code = gimple_code (stmt);
+      enum gimple_code code = gimple_code (stmt);
       if (code == GIMPLE_ASSIGN)
         {
           enum tree_code subcode = gimple_assign_rhs_code (stmt);
Index: gcc/tree-ssa-alias.c
===================================================================
--- gcc/tree-ssa-alias.c	(revision 139906)
+++ gcc/tree-ssa-alias.c	(working copy)
@@ -3216,7 +3216,7 @@
 	 Applications (OOPSLA), pp. 1-19, 1999.  */
       return ESCAPE_STORED_IN_GLOBAL;
     }
-  else if (gimple_code (stmt) == RETURN_EXPR)
+  else if (gimple_code (stmt) == GIMPLE_RETURN)
     return ESCAPE_TO_RETURN;
 
   return NO_ESCAPE;
Index: gcc/ifcvt.c
===================================================================
--- gcc/ifcvt.c	(revision 139906)
+++ gcc/ifcvt.c	(working copy)
@@ -2289,7 +2289,7 @@
       if (GET_MODE (x) == BLKmode)
 	return FALSE;
 
-      if (GET_MODE (x) == ZERO_EXTRACT
+      if (GET_CODE (x) == ZERO_EXTRACT
 	  && (GET_CODE (XEXP (x, 1)) != CONST_INT
 	      || GET_CODE (XEXP (x, 2)) != CONST_INT))
 	return FALSE;
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(revision 139906)
+++ gcc/fortran/symbol.c	(working copy)
@@ -3922,7 +3922,7 @@
   char comp_name[(GFC_MAX_SYMBOL_LEN * 2) + 1];
   int index;
 
-  if (gfc_notification_std (std_for_isocbinding_symbol (s)) == FAILURE)
+  if (gfc_notification_std (std_for_isocbinding_symbol (s)) == ERROR)
     return;
   tmp_symtree = gfc_find_symtree (gfc_current_ns->sym_root, name);
 
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 139906)
+++ gcc/fortran/resolve.c	(working copy)
@@ -994,9 +994,11 @@
   if (need_full_assumed_size || !(sym->as && sym->as->type == AS_ASSUMED_SIZE))
       return false;
 
+  /* FIXME: The comparison "e->ref->u.ar.type == AR_FULL" is wrong.
+     What should it be?  */
   if ((e->ref->u.ar.end[e->ref->u.ar.as->rank - 1] == NULL)
 	  && (e->ref->u.ar.as->type == AS_ASSUMED_SIZE)
-	       && (e->ref->u.ar.type == DIMEN_ELEMENT))
+	       && (e->ref->u.ar.type == AR_FULL))
     {
       gfc_error ("The upper bound in the last dimension must "
 		 "appear in the reference to the assumed size "
@@ -1070,7 +1072,7 @@
 	  continue;
 	}
 
-      if (e->expr_type == FL_VARIABLE && e->symtree->ambiguous)
+      if (e->expr_type == EXPR_VARIABLE && e->symtree->ambiguous)
 	{
 	  gfc_error ("'%s' at %L is ambiguous", e->symtree->n.sym->name,
 		     &e->where);
@@ -1080,7 +1082,7 @@
       if (e->ts.type != BT_PROCEDURE)
 	{
 	  save_need_full_assumed_size = need_full_assumed_size;
-	  if (e->expr_type != FL_VARIABLE)
+	  if (e->expr_type != EXPR_VARIABLE)
 	    need_full_assumed_size = 0;
 	  if (gfc_resolve_expr (e) != SUCCESS)
 	    return FAILURE;
@@ -1224,7 +1226,7 @@
 	 is a  variable instead, it needs to be resolved as it was not
 	 done at the beginning of this function.  */
       save_need_full_assumed_size = need_full_assumed_size;
-      if (e->expr_type != FL_VARIABLE)
+      if (e->expr_type != EXPR_VARIABLE)
 	need_full_assumed_size = 0;
       if (gfc_resolve_expr (e) != SUCCESS)
 	return FAILURE;
Index: gcc/tree-vect-analyze.c
===================================================================
--- gcc/tree-vect-analyze.c	(revision 139906)
+++ gcc/tree-vect-analyze.c	(working copy)
@@ -427,7 +427,7 @@
 	{
 	  gimple stmt = gsi_stmt (si);
 	  stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-	  enum vect_def_type relevance = STMT_VINFO_RELEVANT (stmt_info);
+	  enum vect_relevant relevance = STMT_VINFO_RELEVANT (stmt_info);
 
 	  if (vect_print_dump_info (REPORT_DETAILS))
 	    {
@@ -4081,8 +4081,10 @@
 
 	    case vect_used_in_outer_by_reduction:
 	    case vect_used_in_outer:
-	      gcc_assert (gimple_code (stmt) != WIDEN_SUM_EXPR
-			  && gimple_code (stmt) != DOT_PROD_EXPR);
+	      gcc_assert (gimple_code (stmt) != GIMPLE_ASSIGN
+                          || (gimple_assign_rhs_code (stmt) != WIDEN_SUM_EXPR
+                              && (gimple_assign_rhs_code (stmt)
+                                  != DOT_PROD_EXPR)));
 	      break;
 
 	    case vect_used_by_reduction:
Index: gcc/calls.c
===================================================================
--- gcc/calls.c	(revision 139906)
+++ gcc/calls.c	(working copy)
@@ -3423,7 +3423,7 @@
 	      flags |= ECF_PURE;
 	    }
 
-	  if (GET_MODE (val) == MEM && !must_copy)
+	  if (MEM_P (val) && !must_copy)
 	    slot = val;
 	  else
 	    {
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	(revision 139906)
+++ gcc/rtl.h	(working copy)
@@ -1246,8 +1246,7 @@
 /* Likewise in an expr_list for a REG_LABEL_OPERAND or
    REG_LABEL_TARGET note.  */
 #define LABEL_REF_NONLOCAL_P(RTX)					\
-  (RTL_FLAG_CHECK3("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF,		\
-		   REG_LABEL_OPERAND, REG_LABEL_TARGET)->volatil)
+  (RTL_FLAG_CHECK1("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
 
 /* 1 if RTX is a code_label that should always be considered to be needed.  */
 #define LABEL_PRESERVE_P(RTX)						\
Index: gcc/tree-flow.h
===================================================================
--- gcc/tree-flow.h	(revision 139906)
+++ gcc/tree-flow.h	(working copy)
@@ -676,7 +676,7 @@
 					  struct omp_region *);
 extern void free_omp_regions (void);
 void omp_expand_local (basic_block);
-extern tree find_omp_clause (tree, enum tree_code);
+extern tree find_omp_clause (tree, enum omp_clause_code);
 tree copy_var_decl (tree, tree, tree);
 
 /*---------------------------------------------------------------------------
Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 139906)
+++ gcc/gimple.c	(working copy)
@@ -1085,7 +1085,7 @@
 {
   gimple p = gimple_alloc (GIMPLE_PREDICT, 0);
   /* Ensure all the predictors fit into the lower bits of the subcode.  */
-  gcc_assert (END_PREDICTORS <= GF_PREDICT_TAKEN);
+  gcc_assert ((int) END_PREDICTORS <= GF_PREDICT_TAKEN);
   gimple_predict_set_predictor (p, predictor);
   gimple_predict_set_outcome (p, outcome);
   return p;
@@ -2058,7 +2058,7 @@
 tree
 gimple_get_lhs (const_gimple stmt)
 {
-  enum tree_code code = gimple_code (stmt);
+  enum gimple_code code = gimple_code (stmt);
 
   if (code == GIMPLE_ASSIGN)
     return gimple_assign_lhs (stmt);
@@ -2075,7 +2075,7 @@
 void
 gimple_set_lhs (gimple stmt, tree lhs)
 {
-  enum tree_code code = gimple_code (stmt);
+  enum gimple_code code = gimple_code (stmt);
 
   if (code == GIMPLE_ASSIGN)
     gimple_assign_set_lhs (stmt, lhs);
Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c	(revision 139906)
+++ gcc/tree-cfg.c	(working copy)
@@ -6228,7 +6228,7 @@
       && !(call_flags & ECF_NORETURN))
     return true;
 
-  if (gimple_code (t) == ASM_EXPR
+  if (gimple_code (t) == GIMPLE_ASM
        && (gimple_asm_volatile_p (t) || gimple_asm_input_p (t)))
     return true;
 
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c	(revision 139906)
+++ gcc/reload1.c	(working copy)
@@ -2714,7 +2714,7 @@
 	      /* If this is a REG_DEAD note, it is not valid anymore.
 		 Using the eliminated version could result in creating a
 		 REG_DEAD note for the stack or frame pointer.  */
-	      if (GET_MODE (x) == REG_DEAD)
+	      if (REG_NOTE_KIND (x) == REG_DEAD)
 		return (XEXP (x, 1)
 			? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true)
 			: NULL_RTX);

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