On Sat, 16 Feb 2019, Jakub Jelinek wrote:

> Hi!
> 
> Both the C and C++ standard guarantee that the argc argument to main is
> non-negative, the following patch sets (or adjusts) the corresponding
> SSA_NAME_RANGE_INFO.  While main is just one, with IPA VRP it can also
> propagate etc.  I had to change one testcase because it started optimizing
> it better (the test has been folded away), so no sinking was done.

In C, unlike in C++, it's valid to call main recursively.  I think the 
requirements on argc and argv must be understood to apply only to their 
values on entry to the initial call to main, not to any recursive calls.  
So I don't think this optimization is valid for C (in the absence of 
whole-program information that can prove the absence of any recursive 
calls).

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to