From owner-freebsd-toolchain@freebsd.org Sun Feb 14 03:03:33 2016 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 390CAAA16E7 for ; Sun, 14 Feb 2016 03:03:33 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-151.reflexion.net [208.70.211.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E294D845 for ; Sun, 14 Feb 2016 03:03:32 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 6177 invoked from network); 14 Feb 2016 03:03:31 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 14 Feb 2016 03:03:31 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v7.80.0) with SMTP; Sat, 13 Feb 2016 22:03:39 -0500 (EST) Received: (qmail 14674 invoked from network); 14 Feb 2016 03:03:39 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with SMTP; 14 Feb 2016 03:03:39 -0000 X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 6C85A1C43A0; Sat, 13 Feb 2016 19:03:24 -0800 (PST) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: I've submitted 207175 for a clang 3.8.0 va_list handling problem for powerpc Message-Id: Date: Sat, 13 Feb 2016 19:03:29 -0800 To: FreeBSD PowerPC ML , FreeBSD Toolchain Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2016 03:03:33 -0000 I've isolated another clang 3.8.0 TARGET_ARCH=3Dpowerpc SEGV problem = that shows up for using clang 3.8.0 to buildworld/installworld for = powerpc. > ls -l -n / gets a SEGV. As listed in = https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207175 ( and = https://llvm.org/bugs/show_bug.cgi?id=3D26605 ) the following simplified = program also gets the SEGV on powerpc: > #include // for va_list, va_start, va_arg, va_end > #include // for intmax_t >=20 > intmax_t > va_test (char *s, ...) > { > va_list vap; >=20 > va_start(vap, s); >=20 > char* t0 =3D va_arg(vap, char*); > unsigned int o0 =3D va_arg(vap, unsigned int); > int c0 =3D va_arg(vap, int); > unsigned int u0 =3D va_arg(vap, unsigned int); > int c1 =3D va_arg(vap, int); > char * t1 =3D va_arg(vap, char*); > =20 > intmax_t j0 =3D va_arg(vap, intmax_t); // This spans into = overflow_arg_area. >=20 > int c2 =3D va_arg(vap, int); // A copy was put in = the=20 > // overflow_arg_area = because of the > // above. > // But this tries to = extract from the > // last 4 bytes of the = reg_save_area. > // It does not increment = the > // overflow_arg_area = position pointer > // past the copy that is = there. >=20 > char * t2 =3D va_arg(vap, char*); // The lack of = increment before makes > // this extraction off by = 4 bytes. >=20 > char t2fc =3D *t2; // <<< This gets SEGV. t2 actually got = what should be > // the c2 value. >=20 > intmax_t j1 =3D va_arg(vap, intmax_t); >=20 > va_end(vap); >=20 > return (intmax_t) ((s-t2)+(t0-t1)+o0+u0+j0+j1+c0+c1+c2+t2fc); > // Avoid any optimize-away for lack of use. > } >=20 > int main(void) > { > char s[1025] =3D "test string for this"; >=20 > char* t0 =3D s + 5; > unsigned int o0 =3D 3; > int c0 =3D 1; > unsigned int u0 =3D 1; > int c1 =3D 3; > char * t1 =3D s + 12; > intmax_t j0 =3D 314159265358979323; > int c2 =3D 4; > char * t2 =3D s + 16; > intmax_t j1 =3D ~314159265358979323; >=20 > intmax_t result =3D va_test(s,t0,o0,c0,u0,c1,t1,j0,c1,t2,j1); >=20 > return (int) (result - (intmax_t) = ((s-t2)+(t0-t1)+o0+u0+j0+j1+c0+c1+c2+*t2)); > // Avoid any optimize-away for lack of use. > } =3D=3D=3D Mark Millard markmi at dsl-only.net