diff options
author | Richard Biener <rguenther@suse.de> | 2021-08-09 10:19:10 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-08-10 09:27:49 +0200 |
commit | bb169406cdc9e044eaec500dd742c2fed40f5488 (patch) | |
tree | f89b60e9073bc859ecfdc044a91bb65cf63bdf49 /gcc/tree-nested.c | |
parent | 0631faf87a197145acd833249bf8f20a1c4aaabf (diff) | |
download | gcc-bb169406cdc9e044eaec500dd742c2fed40f5488.zip gcc-bb169406cdc9e044eaec500dd742c2fed40f5488.tar.gz gcc-bb169406cdc9e044eaec500dd742c2fed40f5488.tar.bz2 |
middle-end/101824 - properly handle volatiles in nested fn lowering
When we build the COMPONENT_REF of a formerly volatile local off
the FRAME decl we have to make sure to mark the COMPONENT_REF
as TREE_THIS_VOLATILE. While the GIMPLE operand scanner looks
at the FIELD_DECL this is not how volatile GENERIC refs work.
2021-08-09 Richard Biener <rguenther@suse.de>
PR middle-end/101824
* tree-nested.c (get_frame_field): Mark the COMPONENT_REF as
volatile in case the variable was.
* gcc.dg/tree-ssa/pr101824.c: New testcase.
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r-- | gcc/tree-nested.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 0c3fb02..cc59526 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1033,6 +1033,7 @@ get_frame_field (struct nesting_info *info, tree target_context, } x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); + TREE_THIS_VOLATILE (x) = TREE_THIS_VOLATILE (field); return x; } |