mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
c++, contracts: Only check contracts attributes [PR116607].
The ICE described in the PR is caused by not filtering out non- contract attributes before making the has_active_contract_condition test. Fixed, as suggested by Andrew Pinski, by just using the existing CONTRACT_CHAIN () macro to advance through the list. PR c++/116607 gcc/cp/ChangeLog: * contracts.cc (has_active_contract_condition): Use the CONTRACT_CHAIN macro to advance through the attribute list. gcc/testsuite/ChangeLog: * g++.dg/contracts/pr116607.C: New test. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
This commit is contained in:
parent
e2692b9ea7
commit
673d6b2cbf
@ -1494,7 +1494,7 @@ contract_active_p (tree contract)
|
||||
static bool
|
||||
has_active_contract_condition (tree d, tree_code c)
|
||||
{
|
||||
for (tree as = DECL_CONTRACTS (d) ; as != NULL_TREE; as = TREE_CHAIN (as))
|
||||
for (tree as = DECL_CONTRACTS (d) ; as != NULL_TREE; as = CONTRACT_CHAIN (as))
|
||||
{
|
||||
tree contract = TREE_VALUE (TREE_VALUE (as));
|
||||
if (TREE_CODE (contract) == c && contract_active_p (contract))
|
||||
|
6
gcc/testsuite/g++.dg/contracts/pr116607.C
Normal file
6
gcc/testsuite/g++.dg/contracts/pr116607.C
Normal file
@ -0,0 +1,6 @@
|
||||
// { dg-options "-std=c++20 -fcontracts " }
|
||||
struct a {
|
||||
__attribute__((no_sanitize("")))
|
||||
int f(int) [[pre:true]];
|
||||
};
|
||||
int a::f(int) { return 0; }
|
Loading…
Reference in New Issue
Block a user