#include "target.h"
#include "tree-iterator.h"
#include "bitmap.h"
-#include "pointer-set.h"
#include "basic-block.h"
#include "gimple-expr.h"
#include "gimplify.h"
return error_mark_node;
}
- if (pedantic)
+ if (pedantic || warn_c90_c99_compat)
{
tree foo = array;
while (TREE_CODE (foo) == COMPONENT_REF)
if (TREE_CODE (foo) == VAR_DECL && C_DECL_REGISTER (foo))
pedwarn (loc, OPT_Wpedantic,
"ISO C forbids subscripting %<register%> array");
- else if (!flag_isoc99 && !lvalue_p (foo))
- pedwarn (loc, OPT_Wpedantic,
- "ISO C90 forbids subscripting non-lvalue array");
+ else if (!lvalue_p (foo))
+ pedwarn_c90 (loc, OPT_Wpedantic,
+ "ISO C90 forbids subscripting non-lvalue "
+ "array");
}
type = TREE_TYPE (TREE_TYPE (array));
addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op0)));
addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op1)));
tree target_type = TREE_TYPE (TREE_TYPE (op0));
- tree con0, con1, lit0, lit1;
tree orig_op1 = op1;
/* If the operands point into different address spaces, we need to
else
inttype = restype;
-
if (TREE_CODE (target_type) == VOID_TYPE)
pedwarn (loc, OPT_Wpointer_arith,
"pointer of type %<void *%> used in subtraction");
pedwarn (loc, OPT_Wpointer_arith,
"pointer to a function used in subtraction");
- /* If the conversion to ptrdiff_type does anything like widening or
- converting a partial to an integral mode, we get a convert_expression
- that is in the way to do any simplifications.
- (fold-const.c doesn't know that the extra bits won't be needed.
- split_tree uses STRIP_SIGN_NOPS, which leaves conversions to a
- different mode in place.)
- So first try to find a common term here 'by hand'; we want to cover
- at least the cases that occur in legal static initializers. */
- if (CONVERT_EXPR_P (op0)
- && (TYPE_PRECISION (TREE_TYPE (op0))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0)))))
- con0 = TREE_OPERAND (op0, 0);
- else
- con0 = op0;
- if (CONVERT_EXPR_P (op1)
- && (TYPE_PRECISION (TREE_TYPE (op1))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0)))))
- con1 = TREE_OPERAND (op1, 0);
- else
- con1 = op1;
-
- if (TREE_CODE (con0) == POINTER_PLUS_EXPR)
- {
- lit0 = TREE_OPERAND (con0, 1);
- con0 = TREE_OPERAND (con0, 0);
- }
- else
- lit0 = integer_zero_node;
-
- if (TREE_CODE (con1) == POINTER_PLUS_EXPR)
- {
- lit1 = TREE_OPERAND (con1, 1);
- con1 = TREE_OPERAND (con1, 0);
- }
- else
- lit1 = integer_zero_node;
-
- if (operand_equal_p (con0, con1, 0))
- {
- op0 = lit0;
- op1 = lit1;
- }
-
-
/* First do the subtraction as integers;
then drop through to build the divide operator.
Do not do default conversions on the minus operator
warning_at (loc, OPT_Wreturn_local_addr,
"function returns address of label");
else
- warning_at (loc, OPT_Wreturn_local_addr,
- "function returns address of local variable");
+ {
+ warning_at (loc, OPT_Wreturn_local_addr,
+ "function returns address of local variable");
+ tree zero = build_zero_cst (TREE_TYPE (res));
+ t = build2 (COMPOUND_EXPR, TREE_TYPE (res), t, zero);
+ }
}
break;
tree decl, tree placeholder)
{
copy_body_data id;
- struct pointer_map_t *decl_map = pointer_map_create ();
+ hash_map<tree, tree> decl_map;
- *pointer_map_insert (decl_map, omp_decl1) = placeholder;
- *pointer_map_insert (decl_map, omp_decl2) = decl;
+ decl_map.put (omp_decl1, placeholder);
+ decl_map.put (omp_decl2, decl);
memset (&id, 0, sizeof (id));
id.src_fn = DECL_CONTEXT (omp_decl1);
id.dst_fn = current_function_decl;
id.src_cfun = DECL_STRUCT_FUNCTION (id.src_fn);
- id.decl_map = decl_map;
+ id.decl_map = &decl_map;
id.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_lang_insert_block = NULL;
id.eh_lp_nr = 0;
walk_tree (&stmt, copy_tree_body_r, &id, NULL);
- pointer_map_destroy (decl_map);
return stmt;
}