From cb1ecf3819f19a4fc35468010b66b5c1a7b21ee8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 13 Jun 2022 10:03:36 +0200 Subject: Do not erase warning data in gimple_set_location 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++. --- gcc/gimple.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/gimple.h') diff --git a/gcc/gimple.h b/gcc/gimple.h index 6b1e89a..870629c 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1913,7 +1913,8 @@ static inline void 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; } -- cgit v1.1