diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-23 16:25:29 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-25 17:02:45 +0200 |
commit | 62e02c8729a75c4a859edc18e0bcafb87d717f46 (patch) | |
tree | cf7051a6aaeaef1e2467964429440e81124363df /gcc/d | |
parent | eacfafbc3534fb32782934d765d21855dff32e56 (diff) | |
download | gcc-62e02c8729a75c4a859edc18e0bcafb87d717f46.zip gcc-62e02c8729a75c4a859edc18e0bcafb87d717f46.tar.gz gcc-62e02c8729a75c4a859edc18e0bcafb87d717f46.tar.bz2 |
d: Fix ICE in uda_attribute_p when looking up unknown attribute
The target attribute table is not guaranteed to be set in all backends.
gcc/d/ChangeLog:
PR d/95173
* d-attribs.cc (uda_attribute_p): Don't search target attribute table
if NULL.
gcc/testsuite/ChangeLog:
PR d/95173
* gdc.dg/pr95173.d: New test.
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/d-attribs.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc index 964f59f..f4086c0 100644 --- a/gcc/d/d-attribs.cc +++ b/gcc/d/d-attribs.cc @@ -216,10 +216,13 @@ uda_attribute_p (const char *name) return true; } - for (const attribute_spec *p = targetm.attribute_table; p->name; p++) + if (targetm.attribute_table) { - if (get_identifier (p->name) == ident) - return true; + for (const attribute_spec *p = targetm.attribute_table; p->name; p++) + { + if (get_identifier (p->name) == ident) + return true; + } } return false; |