re PR c/69627 (Conditional jump or move depends on uninitialised value(s) in (anonymous namespace)::layout::get_state_at_point)

PR c/69627
	* diagnostic-show-locus.c (layout::get_state_at_point): Don't read
	range->m_caret fields if range->m_show_caret_p is false.

	* gcc.dg/pr69627.c: New test.

From-SVN: r233114
This commit is contained in:
Jakub Jelinek 2016-02-03 23:40:22 +01:00 committed by Jakub Jelinek
parent eadb8035ac
commit 0afbb81bb6
4 changed files with 37 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2016-02-03 Jakub Jelinek <jakub@redhat.com>
PR c/69627
* diagnostic-show-locus.c (layout::get_state_at_point): Don't read
range->m_caret fields if range->m_show_caret_p is false.
PR target/69644
* config/rs6000/rs6000.c (rs6000_expand_atomic_compare_and_swap):
Force oldval into register if it does not satisfy reg_or_short_operand

View File

@ -722,9 +722,10 @@ layout::get_state_at_point (/* Inputs. */
/* Are we at the range's caret? is it visible? */
out_state->draw_caret_p = false;
if (row == range->m_caret.m_line
if (range->m_show_caret_p
&& row == range->m_caret.m_line
&& column == range->m_caret.m_column)
out_state->draw_caret_p = range->m_show_caret_p;
out_state->draw_caret_p = true;
/* Within a multiline range, don't display any underline
in any leading or trailing whitespace on a line.

View File

@ -1,5 +1,8 @@
2016-02-03 Jakub Jelinek <jakub@redhat.com>
PR c/69627
* gcc.dg/pr69627.c: New test.
PR target/69644
* gcc.dg/pr69644.c: New test.

View File

@ -0,0 +1,27 @@
/* PR c/69627 */
/* { dg-do compile } */
/* { dg-options "-fdiagnostics-show-caret" } */
void
foo ()
{
float t[2] = { 1, 2 };
int const *s = 0;
t[1] / s; /* { dg-error "invalid operands to binary /" } */
/* { dg-begin-multiline-output "" }
t[1] / s;
~~~~ ^
{ dg-end-multiline-output "" } */
}
void
bar ()
{
float t[2] = { 1, 2 };
int const *s[2] = { 0, 0 };
t[1] / s[0]; /* { dg-error "invalid operands to binary /" } */
/* { dg-begin-multiline-output "" }
t[1] / s[0];
~~~~ ^ ~~~~
{ dg-end-multiline-output "" } */
}