From: Martin Liska Date: Fri, 15 Sep 2017 14:11:27 +0000 (+0200) Subject: Backport r251049 X-Git-Tag: releases/gcc-5.5.0~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b2cadb4521955a4349d7f9619d1ac48c701769a;p=thirdparty%2Fgcc.git Backport r251049 2017-09-15 Martin Liska Backport from mainline 2017-08-11 Martin Liska PR tree-opt/79987 * tree-chkp.c (chkp_get_bounds_for_decl_addr): Do not instrument variables of void type. 2017-09-15 Martin Liska Backport from mainline 2017-08-11 Martin Liska PR tree-opt/79987 * gcc.target/i386/mpx/pr79987.c: New test. From-SVN: r252819 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df6a3116d0ff..8093cf663b62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-09-15 Martin Liska + + Backport from mainline + 2017-08-11 Martin Liska + + PR tree-opt/79987 + * tree-chkp.c (chkp_get_bounds_for_decl_addr): Do not instrument + variables of void type. + 2017-09-15 Martin Liska Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f79cb0d3ff60..7c6425f679c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2017-09-15 Martin Liska + + Backport from mainline + 2017-08-11 Martin Liska + + PR tree-opt/79987 + * gcc.target/i386/mpx/pr79987.c: New test. + 2017-09-15 Martin Liska Backport from mainline diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79987.c b/gcc/testsuite/gcc.target/i386/mpx/pr79987.c new file mode 100644 index 000000000000..b3ebda956945 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr79987.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +extern void foo; +void *bar = &foo; /* { dg-warning "taking address of expression of type .void." } */ diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 824827768f48..4d2aa5aeb579 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -3101,6 +3101,9 @@ chkp_get_bounds_for_decl_addr (tree decl) && !flag_chkp_incomplete_type) return chkp_get_zero_bounds (); + if (VOID_TYPE_P (TREE_TYPE (decl))) + return chkp_get_zero_bounds (); + if (flag_chkp_use_static_bounds && TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl)