]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/69627 (Conditional jump or move depends on uninitialised value(s) in (anonymo...
authorJakub Jelinek <jakub@redhat.com>
Wed, 3 Feb 2016 22:40:22 +0000 (23:40 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 3 Feb 2016 22:40:22 +0000 (23:40 +0100)
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

gcc/ChangeLog
gcc/diagnostic-show-locus.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr69627.c [new file with mode: 0644]

index a3fc634f46ad65a0c6e2c0269275768f97dbc87b..142e7a45208f6d369faa984b10776bfa72f16b0d 100644 (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
index d9b6750339b31a0d4c519af4a6a7564b267951e5..3959a1db35ead77cb34fb5921839a1a6069def69 100644 (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.
index d192485acae38941a388e31e715a00daba8d4c2c..72356d164b9f4061727b7b7b8222c61b4d98dc35 100644 (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.
 
diff --git a/gcc/testsuite/gcc.dg/pr69627.c b/gcc/testsuite/gcc.dg/pr69627.c
new file mode 100644 (file)
index 0000000..b7f56cd
--- /dev/null
@@ -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 "" } */
+}