On Mon, Feb 18, 2019 at 11:55:56PM +0100, Jakub Jelinek wrote:
> 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?

No, but nothing is required of the arguments to the main function in a
freestanding implementation.  C11 5.1.2.1/1.

> 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.

GCC hasn't historically required "int" for the first argument of the main
function, as far as I know.  This is separate from saying the main function
is called "main".


Segher

Reply via email to