Commit 04f91503 by Markus Trippelsdorf Committed by Markus Trippelsdorf

Fix UB in hash-map.h

bootstrap-ubsan shows:
  gcc/hash-map.h:277:19: runtime error: member access within null pointer of type 'struct hash_map'

Fix the issue by returning early.

From-SVN: r255166
parent ff27462e
2017-11-27 Markus Trippelsdorf <markus@trippelsdorf.de>
* hash-map.h (gt_cleare_cache): Avoid UB.
2017-11-27 Eric Botcazou <ebotcazou@adacore.com> 2017-11-27 Eric Botcazou <ebotcazou@adacore.com>
* cfgloop.h (struct loop): Document usage of USHRT_MAX for unroll. * cfgloop.h (struct loop): Document usage of USHRT_MAX for unroll.
...@@ -274,7 +274,8 @@ template<typename K, typename V, typename H> ...@@ -274,7 +274,8 @@ template<typename K, typename V, typename H>
static inline void static inline void
gt_cleare_cache (hash_map<K, V, H> *h) gt_cleare_cache (hash_map<K, V, H> *h)
{ {
gt_cleare_cache (&h->m_table); if (h)
gt_cleare_cache (&h->m_table);
} }
template<typename K, typename V, typename H> template<typename K, typename V, typename H>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment