diff options
author | Martin Jambor <mjambor@suse.cz> | 2018-09-26 13:58:18 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2018-09-26 13:58:18 +0200 |
commit | ce6f08888905bb217b9a4cff8a0704e240ec5c46 (patch) | |
tree | 27fced792fd811917cce17da29add793504cfcf5 /gcc/c/c-parser.c | |
parent | 6fe0c58b9fe04b112586fe0ffecc18a24b313c50 (diff) | |
download | gcc-ce6f08888905bb217b9a4cff8a0704e240ec5c46.zip gcc-ce6f08888905bb217b9a4cff8a0704e240ec5c46.tar.gz gcc-ce6f08888905bb217b9a4cff8a0704e240ec5c46.tar.bz2 |
[PR 87347] Prevent segfaults if TYPE_ARG_TYPES is NULL
2018-09-26 Martin Jambor <mjambor@suse.cz>
PR c/87347
c/
* c-parser.c (warn_for_abs): Bail out if TYPE_ARG_TYPES is NULL. Fix
comment.
testsuite/
* gcc.dg/pr87347.c: New test.
From-SVN: r264640
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 1766a25..1f173fc 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -9102,8 +9102,8 @@ sizeof_ptr_memacc_comptypes (tree type1, tree type2) } /* Warn for patterns where abs-like function appears to be used incorrectly, - gracely ignore any non-abs-like function. The warning location should be - LOC. FNDECL is the declaration of called function, it must be a + gracefully ignore any non-abs-like function. The warning location should + be LOC. FNDECL is the declaration of called function, it must be a BUILT_IN_NORMAL function. ARG is the first and only argument of the call. */ @@ -9223,6 +9223,9 @@ warn_for_abs (location_t loc, tree fndecl, tree arg) return; } + if (!TYPE_ARG_TYPES (TREE_TYPE (fndecl))) + return; + tree ftype = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (fndecl))); if (TREE_CODE (atype) == COMPLEX_TYPE) { |