diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-09-21 14:32:26 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-09-21 14:32:26 -0700 |
commit | a5b5cabc91c38710adbe5c8a2b53882abe994441 (patch) | |
tree | 66b099a6ebc2076ef353afa90d9703824d023812 /gcc/tree-ssa-strlen.c | |
parent | a0791d0ed4f147ef347e83f4aedc7ad03f1a2008 (diff) | |
parent | 09e18d113b3c3dae896ac1a8ad1e0087adbb153b (diff) | |
download | gcc-a5b5cabc91c38710adbe5c8a2b53882abe994441.zip gcc-a5b5cabc91c38710adbe5c8a2b53882abe994441.tar.gz gcc-a5b5cabc91c38710adbe5c8a2b53882abe994441.tar.bz2 |
Merge from trunk revision 09e18d113b3c3dae896ac1a8ad1e0087adbb153b.
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 7c93958..7c568a4 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -199,16 +199,22 @@ static bool handle_assign (gimple_stmt_iterator *, tree, bool *, /* Sets MINMAX to either the constant value or the range VAL is in and returns either the constant value or VAL on success or null - when the range couldn't be determined. Uses RVALS when nonnull - to determine the range, otherwise uses CFUN or global range info, - whichever is nonnull. */ + when the range couldn't be determined. Uses RVALS or CFUN for + range info, whichever is nonnull. */ tree get_range (tree val, gimple *stmt, wide_int minmax[2], range_query *rvals /* = NULL */) { if (!rvals) - rvals = get_range_query (cfun); + { + if (!cfun) + /* When called from front ends for global initializers CFUN + may be null. */ + return NULL_TREE; + + rvals = get_range_query (cfun); + } value_range vr; if (!rvals->range_of_expr (vr, val, stmt)) |