public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4206] Ensure at_stmt is defined before an early exit
@ 2022-11-21 16:01 Andrew Carlotti
  0 siblings, 0 replies; only message in thread
From: Andrew Carlotti @ 2022-11-21 16:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f0e4f676aab589e53dbd67610378a1769030f462

commit r13-4206-gf0e4f676aab589e53dbd67610378a1769030f462
Author: Andrew Carlotti <andrew.carlotti@arm.com>
Date:   Thu Oct 6 15:59:15 2022 +0100

    Ensure at_stmt is defined before an early exit
    
    This prevents a null dereference error when outputing debug information
    following an early exit from number_of_iterations_exit_assumptions.
    
    gcc/ChangeLog:
    
            * tree-ssa-loop-niter.cc (number_of_iterations_exit_assumptions):
            Move at_stmt assignment.

Diff:
---
 gcc/tree-ssa-loop-niter.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index 3fbbf4367ed..df995a66676 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -2537,6 +2537,9 @@ number_of_iterations_exit_assumptions (class loop *loop, edge exit,
   if (!stmt)
     return false;
 
+  if (at_stmt)
+    *at_stmt = stmt;
+
   /* We want the condition for staying inside loop.  */
   code = gimple_cond_code (stmt);
   if (exit->flags & EDGE_TRUE_VALUE)
@@ -2642,9 +2645,6 @@ number_of_iterations_exit_assumptions (class loop *loop, edge exit,
   if (TREE_CODE (niter->niter) == INTEGER_CST)
     niter->max = wi::to_widest (niter->niter);
 
-  if (at_stmt)
-    *at_stmt = stmt;
-
   return (!integer_zerop (niter->assumptions));
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-21 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 16:01 [gcc r13-4206] Ensure at_stmt is defined before an early exit Andrew Carlotti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).