diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-16 14:26:04 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-16 14:26:04 +0000 |
commit | 857612dd6944414ec404f670b435839925068758 (patch) | |
tree | a1ad851e4c94d70827a9d1e78a39a7e4e7de0435 /gcc/fold-const.c | |
parent | 925e34bba63df6b4961962746fac1f1d7b8bf467 (diff) | |
download | gcc-857612dd6944414ec404f670b435839925068758.tar.gz |
2015-09-16 Richard Biener <rguenther@suse.de>
PR middle-end/67271
* fold-const.c (native_encode_expr): Bail out on bogus offsets.
* gcc.dg/pr67271.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227825 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fd1c87ed5ad..15214507f08 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7110,6 +7110,10 @@ native_encode_string (const_tree expr, unsigned char *ptr, int len, int off) int native_encode_expr (const_tree expr, unsigned char *ptr, int len, int off) { + /* We don't support starting at negative offset and -1 is special. */ + if (off < -1) + return 0; + switch (TREE_CODE (expr)) { case INTEGER_CST: |