diff options
author | Martin Sebor <msebor@redhat.com> | 2016-06-10 17:38:19 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2016-06-10 11:38:19 -0600 |
commit | 4d926e34935942f5aa388388f441e61d7f007c99 (patch) | |
tree | 65d78393bc8d9d87c657b1577f94ea00168ceaaf /gcc/lto | |
parent | a102ee4ba8e347318c65432b26d1220d6eca1329 (diff) | |
download | gcc-4d926e34935942f5aa388388f441e61d7f007c99.zip gcc-4d926e34935942f5aa388388f441e61d7f007c99.tar.gz gcc-4d926e34935942f5aa388388f441e61d7f007c99.tar.bz2 |
PR c/71392 - SEGV calling integer overflow built-ins with a null pointer
gcc/ChangeLog:
2016-06-10 Martin Sebor <msebor@redhat.com>
PR c/71392
* builtin-attrs.def (ATTR_NOTHROW_NONNULL_LEAF_LIST): New macro.
(ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF): Same.
* builtins.def (BUILT_IN_SADD_OVERFLOW, BUILT_IN_SADDL_OVERFLOW): Use
them.
(BUILT_IN_SADDLL_OVERFLOW, BUILT_IN_SSUB_OVERFLOW): Same.
(BUILT_IN_SSUBL_OVERFLOW, BUILT_IN_SSUBLL_OVERFLOW): Same.
(BUILT_IN_SMUL_OVERFLOW, BUILT_IN_SMULL_OVERFLOW): Same.
(BUILT_IN_SMULLL_OVERFLOW, BUILT_IN_UADD_OVERFLOW): Same.
(BUILT_IN_UADDL_OVERFLOW, BUILT_IN_UADDLL_OVERFLOW): Same.
(BUILT_IN_USUB_OVERFLOW, BUILT_IN_USUBL_OVERFLOW): Same.
(BUILT_IN_USUBLL_OVERFLOW, BUILT_IN_UMUL_OVERFLOW): Same.
(BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW):
gcc/ada/ChangeLog:
2016-06-10 Martin Sebor <msebor@redhat.com>
PR c/71392
* gcc/ada/gcc-interface/utils.c (handle_nonnull_attribute): Accept
the nonnull attribute in type-generic builtins.
gcc/c-family/ChangeLog:
2016-06-10 Martin Sebor <msebor@redhat.com>
PR c/71392
* gcc/c-family/c-common.c (handle_nonnull_attribute): Accept
the nonnull attribute in type-generic builtins.
gcc/lto/ChangeLog:
2016-06-10 Martin Sebor <msebor@redhat.com>
PR c/71392
* gcc/lto/lto-lang.c (handle_nonnull_attribute): Accept the nonnull
attribute in type-generic builtins.
gcc/testsuite/ChangeLog:
2016-06-10 Martin Sebor <msebor@redhat.com>
PR c/71392
* c-c++-common/builtin-arith-overflow-1.c: Add test cases.
From-SVN: r237314
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/lto-lang.c | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 06458d4..9323a255 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2016-06-10 Martin Sebor <msebor@redhat.com> + + PR c/71392 + * gcc/lto/lto-lang.c (handle_nonnull_attribute): Accept the nonnull + attribute in type-generic builtins. + 2016-05-16 Jan Hubicka <hubicka@ucw.cz> * lto-partition.c (add_symbol_to_partition_1): Likewise. diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index b5efe3a..301cf21 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -352,10 +352,15 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), /* If no arguments are specified, all pointer arguments should be non-null. Verify a full prototype is given so that the arguments - will have the correct types when we actually check them later. */ + will have the correct types when we actually check them later. + Avoid diagnosing type-generic built-ins since those have no + prototype. */ if (!args) { - gcc_assert (prototype_p (type)); + gcc_assert (prototype_p (type) + || !TYPE_ATTRIBUTES (type) + || lookup_attribute ("type generic", TYPE_ATTRIBUTES (type))); + return NULL_TREE; } |