Hi,
In function ref_maybe_used_by_call_p_1, there is below code snippet
         /* The following builtins do not read from memory.  */
         case BUILT_IN_FREE:
         ...
           return false;

I am confused because free function does read from (and even write to)
memory pointed to by passed argument?
I am thinking DSE optimizations like:
  *ptr = value;
  free(ptr);
  *ptr = undef;
Does GCC take advantage of UB to eliminate the first store to ptr if
free is considered not reading memory?

Thanks,
bin

Reply via email to