diff options
author | Richard Biener <rguenther@suse.de> | 2020-03-11 15:34:47 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-03-11 15:35:51 +0100 |
commit | cb99630f254aaec6591e0a200b79905b31d24eb3 (patch) | |
tree | dc528f98350f3bac9c438420b4d2032bdbd7ca2d /gcc/cp/constraint.cc | |
parent | d564c5e254df744a470a658690753dc193a4fa78 (diff) | |
download | gcc-cb99630f254aaec6591e0a200b79905b31d24eb3.zip gcc-cb99630f254aaec6591e0a200b79905b31d24eb3.tar.gz gcc-cb99630f254aaec6591e0a200b79905b31d24eb3.tar.bz2 |
fold undefined pointer offsetting
This avoids breaking the old broken pointer offsetting via
(T)(ptr - ((T)0)->x) which should have used offsetof. Breakage
was exposed by the introduction of POINTER_DIFF_EXPR and making
PTA not considering that producing a pointer. The mitigation
for simple cases is to canonicalize
_2 = _1 - 8B;
o_9 = (struct obj *) _2;
to
o_9 = &MEM[_1 + -8B];
eliding one statement and the offending pointer subtraction.
2020-03-11 Richard Biener <rguenther@suse.de>
* match.pd ((T *)(ptr - ptr-cst) -> &MEM[ptr + -ptr-cst]):
New pattern.
* gcc.dg/torture/20200311-1.c: New testcase.
Diffstat (limited to 'gcc/cp/constraint.cc')
0 files changed, 0 insertions, 0 deletions