aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2019-02-22 16:24:36 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2019-02-22 09:24:36 -0700
commit3c2a70cb1414b10ab3d52286087398cd03a70413 (patch)
tree34bd4615f175e082208c635ea524cf2c610a5199 /gcc/c
parentd228ac9ae52cc33ea572da89f325f8aeebd9eb32 (diff)
downloadgcc-3c2a70cb1414b10ab3d52286087398cd03a70413.zip
gcc-3c2a70cb1414b10ab3d52286087398cd03a70413.tar.gz
gcc-3c2a70cb1414b10ab3d52286087398cd03a70413.tar.bz2
PR c/89425 - -Wabsolute-value warns in dead subexpressions
gcc/c/ChangeLog: PR c/89425 * c-parser.c (sizeof_ptr_memacc_comptypes): Avoid warning in unreachable subexpressions. gcc/testsuite/ChangeLog: PR c/89425 * gcc.dg/Wabsolute-value.c: New test. From-SVN: r269121
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-parser.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 22c7416..ee722cc 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -9374,6 +9374,10 @@ sizeof_ptr_memacc_comptypes (tree type1, tree type2)
static void
warn_for_abs (location_t loc, tree fndecl, tree arg)
{
+ /* Avoid warning in unreachable subexpressions. */
+ if (c_inhibit_evaluation_warnings)
+ return;
+
tree atype = TREE_TYPE (arg);
/* Casts from pointers (and thus arrays and fndecls) will generate