/* Initialize the object. */
access_ref::access_ref ()
- : ref (), eval ([](tree x){ return x; }), deref (), trail1special (true),
- base0 (true), parmarray ()
+ : ref (), eval ([](tree x){ return x; }), deref (), ref_nullptr_p (false),
+ trail1special (true), base0 (true), parmarray ()
{
/* Set to valid. */
offrng[0] = offrng[1] = 0;
loc = EXPR_LOCATION (ref);
else if (TREE_CODE (ref) != IDENTIFIER_NODE
&& TREE_CODE (ref) != SSA_NAME)
- return;
+ {
+ if (TREE_CODE (ref) == INTEGER_CST && ref_nullptr_p)
+ {
+ if (mode == access_read_write || mode == access_write_only)
+ inform (loc, "destination object is likely at address zero");
+ else
+ inform (loc, "source object is likely at address zero");
+ }
+ return;
+ }
if (mode == access_read_write || mode == access_write_only)
{
if (targetm.addr_space.zero_address_valid (as))
pref->set_max_size_range ();
else
- pref->sizrng[0] = pref->sizrng[1] = 0;
+ {
+ pref->sizrng[0] = pref->sizrng[1] = 0;
+ pref->ref_nullptr_p = true;
+ }
}
else
pref->sizrng[0] = pref->sizrng[1] = 0;
argument to the minimum. */
offset_int size_remaining (offset_int * = nullptr) const;
-/* Return true if the offset and object size are in range for SIZE. */
+ /* Return true if the offset and object size are in range for SIZE. */
bool offset_in_range (const offset_int &) const;
/* Return true if *THIS is an access to a declared object. */
/* Positive when REF is dereferenced, negative when its address is
taken. */
int deref;
+ /* The following indicates if heuristics interpreted 'ref' is interpreted
+ as (offsetted) nullptr. */
+ bool ref_nullptr_p;
/* Set if trailing one-element arrays should be treated as flexible
array members. */
bool trail1special;