Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: [clang] -Os invalid content of argc+argv Date: Thu, 03 Sep 2015 16:43:58 -0700 Organization: None to speak of Lines: 20 Message-ID: References: <68a9e68b-dc3b-4c5e-8d01-bc91daaeb0f2@googlegroups.com> <20150903233124.38258cdb@maxa-pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="31294"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/VOo/vr5z9fimTrK/j6nTt" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Nlr79/0iGMi/DiE2vomNXjRiTAw= sha1:NYK/n77kxBZ0Z8082W9/aBPwIAw= Xref: csiph.com comp.lang.c:69242 Melzzzzz writes: [...] > I don't know about cygwin but argc/argv values are parsed with crt > on Linux. That is if you link with c runtime and write main in assembler > you get already parsed values eg Linux passes values on stack but crt > parses them into rdi,rsi registers... > Probably on cygwin compiler parses those values therefore bug. The command line is parsed by the shell, which then passes them to your program using one of the exec*() functions. The compiler doesn't parse your program's command line arguments (because they don't exist yet). It merely generates code that is able to receive those arguments via the argc and argv parameters. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"