From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/35 Path: news.gmane.org!not-for-mail From: Igmar Palsenberg Newsgroups: gmane.linux.lib.musl.general Subject: Re: Musl git 0d......455eee8 and recent compilers Date: Mon, 6 Jun 2011 12:47:38 +0200 Message-ID: References: <20110606102742.GM6142@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1307357286 5209 80.91.229.12 (6 Jun 2011 10:48:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Jun 2011 10:48:06 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-118-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jun 06 12:48:01 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QTXLl-0004lv-B5 for gllmg-musl@lo.gmane.org; Mon, 06 Jun 2011 12:48:01 +0200 Original-Received: (qmail 3373 invoked by uid 550); 6 Jun 2011 10:48:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3365 invoked from network); 6 Jun 2011 10:48:00 -0000 In-Reply-To: <20110606102742.GM6142@port70.net> X-Mailer: Apple Mail (2.1084) Xref: news.gmane.org gmane.linux.lib.musl.general:35 Archived-At: > * Igmar Palsenberg [2011-06-06 10:48:08 +0200]: >> I was using Musle as a test for.. >=20 > musl Sorry.... It's also the name of a cleaning substance here, so I usually = het the name wrong :) =20 >=20 >> 1) The struct dirent in include/dirent.h uses a 1 byte array for = d_name. In reality, it's larger : We allocate more space than the = struct. Since muscle requires a C99 compiler anyway, what's keeping use = from using d_name[0] or d_name[] ? If a C89 compiler includes dirent.h, = we're screwed anyway :). That will probably silence GCC 4.5 and clang, = and severely reduce the warnings it gives in similar cases. >>=20 >=20 > what kind of warnings do you get? Array out of bounds : src/misc/nftw.c:77:11: warning: array index of '1' indexes past the end = of an array (that contains 1 elements) [-Warray-bounds] && (!de->d_name[1] The compiler is strictly speaking right in this case. > char foo[1] gives warning but a flexible array member char foo[] does = not? Correct.=20 >> 2) The NULL pointer dereference in src/time/__asctime.c won't work = with clang : It removes it. I suggest using either __builtin_trap() or = an abort(). If you get to that point, you're in trouble anyway. >>=20 >=20 > i guess __builtin_trap is compiler specific > i don't think it's a big deal.. > there could be 0/0 as well i guess > i wonder what > main(){ return *(int*)0; } > or even > main(){ return ((int(*)())0)(); } > does on clang.. Hmm.. Despite the warning : int main(int argc, char **argv) = =20 { = =20 *(int*)0 =3D 0; = =20 printf("XXX\n"); = =20 return 0; = =20 } segfaults. Clang is allowed to remove the dereference, we might to use = abort() in this case. With O3, it gives an illegal instruction (probably = an ud2). I either misread the warning, or clang doesn't do what it says = :). >=20 >> 3) Clang does't seem to grasp the weak_alias thingy. It need to check = if those parts actually are correct >>=20 >=20 > well it uses the alias __attribute__ extension of gcc I need to check if the offending function / alias is there, or as clang = says, isn't emitted. >> 4) Is there a muscl testsuite somewhere ? >>=20 >=20 > musl >=20 > http://git.etalabs.net/cgi-bin/gitweb.cgi I'll try that. Regards, Igmar