aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-09-16 14:26:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-09-16 14:26:04 +0000
commit486bc8471fd5de49262f2b36a17b1be5915436e1 (patch)
treea1ad851e4c94d70827a9d1e78a39a7e4e7de0435 /gcc/fold-const.c
parentb0463d3db4c5dffff7c0edbbeb48a564a8476787 (diff)
downloadgcc-486bc8471fd5de49262f2b36a17b1be5915436e1.zip
gcc-486bc8471fd5de49262f2b36a17b1be5915436e1.tar.gz
gcc-486bc8471fd5de49262f2b36a17b1be5915436e1.tar.bz2
re PR middle-end/67271 (ICE with -O1,2,3 on darwin14.5 x86_64)
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. From-SVN: r227825
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index fd1c87e..1521450 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: