diff options
author | Richard Biener <rguenther@suse.de> | 2021-01-19 12:29:18 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-01-19 13:22:40 +0100 |
commit | 7d6f7e92c3b737736a2d8ff97a71af9f230c2f88 (patch) | |
tree | 0981bc255a108b38012d7f55bbd81ea18eed2496 /gcc/tree-inline.c | |
parent | 049bfd186fae9fb764a3ec04acb20d3eaacda7a3 (diff) | |
download | gcc-7d6f7e92c3b737736a2d8ff97a71af9f230c2f88.zip gcc-7d6f7e92c3b737736a2d8ff97a71af9f230c2f88.tar.gz gcc-7d6f7e92c3b737736a2d8ff97a71af9f230c2f88.tar.bz2 |
ipa/97673 - fix input_location leak
This fixes input_location leaking with an invalid BLOCK from
expand_call_inline to tree_function_versioning via clone
materialization.
2021-01-19 Richard Biener <rguenther@suse.de>
PR ipa/97673
* tree-inline.c (tree_function_versioning): Set input_location
to UNKNOWN_LOCATION throughout the function.
* gfortran.dg/pr97673.f90: New testcase.
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index cd3fad1..a710fa5 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -6215,6 +6215,12 @@ tree_function_versioning (tree old_decl, tree new_decl, auto_vec<gimple *, 10> init_stmts; tree vars = NULL_TREE; + /* We can get called recursively from expand_call_inline via clone + materialization. While expand_call_inline maintains input_location + we cannot tolerate it to leak into the materialized clone. */ + location_t saved_location = input_location; + input_location = UNKNOWN_LOCATION; + gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL && TREE_CODE (new_decl) == FUNCTION_DECL); DECL_POSSIBLY_INLINED (old_decl) = 1; @@ -6516,6 +6522,7 @@ tree_function_versioning (tree old_decl, tree new_decl, gcc_assert (!id.debug_stmts.exists ()); pop_cfun (); + input_location = saved_location; return; } |