gimple_set_location is mostly invoked on newly built GIMPLE statements, so
their location is UNKNOWN_LOCATION and setting it will clobber the warning
data of the passed location, if any.
gcc/
* dwarf2out.cc (output_one_line_info_table): Initialize prev_addr.
* gimple.h (gimple_set_location): Do not copy warning data from
the previous location when it is UNKNOWN_LOCATION.
* optabs.cc (expand_widen_pattern_expr): Always set oprnd{1,2}.
gcc/testsuite/
* c-c++-common/nonnull-1.c: Remove XFAIL for C++.
char line_label[MAX_ARTIFICIAL_LABEL_BYTES];
unsigned int current_line = 1;
bool current_is_stmt = DWARF_LINE_DEFAULT_IS_STMT_START;
- dw_line_info_entry *ent, *prev_addr;
+ dw_line_info_entry *ent, *prev_addr = NULL;
size_t i;
unsigned int view;
gimple_set_location (gimple *g, location_t location)
{
/* Copy the no-warning data to the statement location. */
- copy_warning (location, g->location);
+ if (g->location != UNKNOWN_LOCATION)
+ copy_warning (location, g->location);
g->location = location;
}
bool sbool = false;
oprnd0 = ops->op0;
- if (nops >= 2)
- oprnd1 = ops->op1;
- if (nops >= 3)
- oprnd2 = ops->op2;
+ oprnd1 = nops >= 2 ? ops->op1 : NULL_TREE;
+ oprnd2 = nops >= 3 ? ops->op2 : NULL_TREE;
tmode0 = TYPE_MODE (TREE_TYPE (oprnd0));
if (ops->code == VEC_UNPACK_FIX_TRUNC_HI_EXPR
__attribute__((nonnull (1))) int
func2 (char *cp)
{
- return (cp != NULL) ? 1 : 0; /* { dg-warning "'nonnull' argument" "cp compared to NULL" { xfail c++ } } */
+ return (cp != NULL) ? 1 : 0; /* { dg-warning "'nonnull' argument" "cp compared to NULL" } */
}