]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR sanitizer/81281
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Dec 2017 19:22:06 +0000 (19:22 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Dec 2017 19:22:06 +0000 (19:22 +0000)
commitbdcc09daafb027afb7d3cb30b84ffcb0e330ca7e
treeb4e1816175ba649a8f594b1c017f750ae055d13a
parentf3969b4952bf2a39cf61514aa571b96e080ddbbe
PR sanitizer/81281
* match.pd ((T)(P + A) - (T)P -> (T) A): Split into separate
simplify for plus with :c added, and pointer_plus without that.
((T)P - (T)(P + A) -> -(T) A): Likewise.  If type is integral
with undefined overflow and the conversion is not widening,
perform negation in utype and only convert to type afterwards.
((T)(P + A) - (T)(P + B) -> (T)A - (T)B): Split into separate
simplify for plus with :c added, and pointer_plus without that.
If type is integral with undefined overflow and the conversion is
not widening, perform minus in utype and only convert to type
afterwards.  Move the last pointer_diff_expr simplify into the
two outermost ifs.

* gcc.c-torture/execute/pr81281.c: New test.
* gcc.dg/pr81281-1.c: New test.
* gcc.dg/pr81281-2.c: New test.
* g++.dg/ubsan/pr81281.C: New test.
* g++.dg/ubsan/pr81281-aux.cc: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255449 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ubsan/pr81281-aux.cc [new file with mode: 0644]
gcc/testsuite/g++.dg/ubsan/pr81281.C [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr81281.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr81281-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr81281-2.c [new file with mode: 0644]