aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-06-04 13:44:58 +0200
committerRichard Biener <rguenther@suse.de>2020-06-05 08:35:44 +0200
commit80d6f89e78fc3b772701988cc73aa8e8006283be (patch)
treefe41e78187e7dc97dbb204546c0e8572c1f944ca /gcc/expr.c
parent6c6931a353a6c41b2c9eb4bd2abec540104e940f (diff)
downloadgcc-80d6f89e78fc3b772701988cc73aa8e8006283be.zip
gcc-80d6f89e78fc3b772701988cc73aa8e8006283be.tar.gz
gcc-80d6f89e78fc3b772701988cc73aa8e8006283be.tar.bz2
middle-end/95493 - bogus MEM_ATTRS for variable array access
The following patch avoids keeping the inherited MEM_ATTRS when set_mem_attributes_minus_bitpos is called with a variable ARRAY_REF. The inherited ones may not reflect the correct offset and neither does the updated alias-set match the inherited MEM_EXPR. This all ends up confusing path-based alias-analysis, causing wrong-code. The fix is to stop not adopting a MEM_EXPR for certain kinds of expressions and instead handle everything we can. There's still the constant kind trees case which I'm too lazy to look into right now. I did refrain from adding SSA_NAME there and instead avoided calling set_mem_attributes_minus_bitpos when debug expression expansion ended up expanding a SSA definition RHS which should already have taken care of setting the appropriate MEM_ATTRS. 2020-06-04 Richard Biener <rguenther@suse.de> PR middle-end/95493 * cfgexpand.c (expand_debug_expr): Avoid calling set_mem_attributes_minus_bitpos when we were expanding an SSA name. * emit-rtl.c (set_mem_attributes_minus_bitpos): Remove ARRAY_REF special-casing, add CONSTRUCTOR to the set of special-cases we do not want MEM_EXPRs for. Assert we end up with reasonable MEM_EXPRs. * g++.dg/torture/pr95493.C: New testcase.
Diffstat (limited to 'gcc/expr.c')
0 files changed, 0 insertions, 0 deletions