On Mon, Feb 18, 2019 at 04:47:57PM -0600, Segher Boessenkool wrote: > On Sat, Feb 16, 2019 at 08:12:34AM +0100, Jakub Jelinek wrote: > > 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. > > I think this should test for flag_hosted somehow? And check that this is
Why? Does -ffreestanding mean it can violate the C/C++ requirements? AFAIK we don't guard other MAIN_NAME_P uses in the compiler with C/C++ checks. E.g. "Nothing escapes by returning from main though." in tree-ssa-structalias.c, various other spots. > a C-like language anyway? The patch used to do that check, but I think we should be able to avoid that. I think in other languages main is just a C wrapper or compiler generated C-like wrapper that actually calls the main program's subroutine and so the C requirements apply to it too. Jakub