From unknown Sat Aug 16 14:26:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16535: Compiler bug ? Resent-From: Fabrice Popineau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jan 2014 15:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 16535@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13905758433012 (code B ref -1); Fri, 24 Jan 2014 15:05:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jan 2014 15:04:03 +0000 Received: from localhost ([127.0.0.1]:34666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6iIb-0000mJ-O9 for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:04:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46986) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6iIY-0000m1-6B for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6iIS-0005AR-Rz for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:03:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6iIS-0005AM-PK for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:03:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6iIJ-0005Ox-4j for bug-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:03:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6iIE-00058W-Dq for bug-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:03:43 -0500 Received: from mail-ee0-x231.google.com ([2a00:1450:4013:c00::231]:52325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6iIE-00058J-6V for bug-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:03:38 -0500 Received: by mail-ee0-f49.google.com with SMTP id d17so1011374eek.22 for ; Fri, 24 Jan 2014 07:03:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=hjs1n97RGv2j89A89Vlm1GriMb0E1KcVdMn+Z3xdS/o=; b=kJq+Gr33T6kGLBBQQd6wRA3Vkz16K8cm03rshOKJV0BoY4TPNAXwwIsM9+hvkdClFb 0F+KUw2jqp/v9d+w/AY50gGDkimJ35lRrN5iWPDyqGsswRVkXHChAVtoo5q12B2BcKDz DpllfDZQb4EYdonZWMwYm42eRCsCBp96Zu5l3aQ/OrRbE9kRB5SycT+BoKHI22cfMAJk Sty8xdHa41Dw6N0R7dXpPAA+sHZlXLDwHETrANtZv6xYt4nAv6PZAeebP1nyuCE74LbU 0MjCvG/I0o48n1Jh32QhWJmNRQhlncTNn4iA8vejtmWkOVDhvpHwXQA/N7TPEmULJS3D RuOw== X-Received: by 10.15.110.133 with SMTP id ch5mr186637eeb.112.1390575817243; Fri, 24 Jan 2014 07:03:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.8.196 with HTTP; Fri, 24 Jan 2014 07:03:17 -0800 (PST) From: Fabrice Popineau Date: Fri, 24 Jan 2014 16:03:17 +0100 Message-ID: Content-Type: multipart/alternative; boundary=089e016354ac9ec17004f0b8a90d X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --089e016354ac9ec17004f0b8a90d Content-Type: text/plain; charset=ISO-8859-1 I hit a bug while compiling Gnu Emacs trunk development. The following test : passed 17/1152 bool-vector-count-population-1-nil fails unless I apply the following patch : === modified file 'src/data.c' --- src/data.c 2014-01-03 06:47:27 +0000 +++ src/data.c 2014-01-24 14:59:16 +0000 @@ -3012,8 +3012,10 @@ { int i = 0, count = 0; while (count += count_one_bits_ll (w), - BITS_PER_BITS_WORD <= (i += BITS_PER_ULL)) + BITS_PER_BITS_WORD <= i) { + i += BITS_PER_ULL; w = shift_right_ull (w); + } return count; } } This is with : $ gcc --version gcc.exe (Rev6, Built by MSYS2 project) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Given the nature of the patch, I don't think it is specific of th MinGW64 gcc version. Regards, Fabrice Popineau --089e016354ac9ec17004f0b8a90d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I hit a bug while compiling Gnu Emacs trunk development.
The following test :
=A0passed =A0 =A017/1= 152 =A0bool-vector-count-population-1-nil
fails unless I ap= ply the following patch :

=A0=3D=3D=3D modified file 'src/data.c'
--- src/data.c =A02014-01-03 06:47:27 +0000
+++ src/data.= c =A02014-01-24 14:59:16 +0000
@@ -3012,8 +3012,10 @@
= =A0 =A0 =A0{
=A0 =A0 =A0 =A0int i =3D 0, count =3D 0;
=A0 =A0 =A0 =A0whil= e (count +=3D count_one_bits_ll (w),
- =A0 =A0 =A0 =A0 =A0 =A0BIT= S_PER_BITS_WORD <=3D (i +=3D BITS_PER_ULL))
+ =A0 =A0 =A0 =A0 = =A0 =A0BITS_PER_BITS_WORD <=3D i) {
+ =A0 =A0 =A0 i +=3D BITS_PER_ULL;
=A0 =A0 =A0 =A0 w =3D shift_ri= ght_ull (w);
+ =A0 =A0 =A0}
=A0 =A0 =A0 =A0return count= ;
=A0 =A0 =A0}
=A0}

This= is with :
$ gcc --version
gcc.exe (Rev6, Built by MSYS2 project) 4.8.2
Copyright (C) 2= 013 Free Software Foundation, Inc.
This is free software; see the= source for copying conditions. =A0There is NO
warranty; not even= for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Given the nature of the patch, I don't think = it is specific of th MinGW64 gcc version.

Regards,=

Fabrice Popineau=A0
--089e016354ac9ec17004f0b8a90d-- From unknown Sat Aug 16 14:26:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16535: Optimization bug? References: In-Reply-To: Resent-From: Fabrice Popineau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jan 2014 16:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 16535@debbugs.gnu.org Received: via spool by 16535-submit@debbugs.gnu.org id=B16535.139058095811447 (code B ref 16535); Fri, 24 Jan 2014 16:30:03 +0000 Received: (at 16535) by debbugs.gnu.org; 24 Jan 2014 16:29:18 +0000 Received: from localhost ([127.0.0.1]:34709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6jd6-0002yY-Sw for submit@debbugs.gnu.org; Fri, 24 Jan 2014 11:29:17 -0500 Received: from mail-ee0-f45.google.com ([74.125.83.45]:35400) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6jd4-0002yO-KB for 16535@debbugs.gnu.org; Fri, 24 Jan 2014 11:29:15 -0500 Received: by mail-ee0-f45.google.com with SMTP id b15so1067374eek.32 for <16535@debbugs.gnu.org>; Fri, 24 Jan 2014 08:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Guns6/bPAvxl1f3g7EoLEliQHcZAflq2edCqS5pZwFQ=; b=JNk7AvvSQVajfB+MESR4E2EYmao+6VXzy3hF1wQGvynXF9f9I0oYynW1wNbOsn8ZsM FL965q2dTMpZe1rRLTLneNR0Y5kMAhpBnGgMJG3HcSUYTVXVo6ZCqFx2aTiULoYW2+VF w5vmnOYGiiAEsm6gAWOdruqix33CYNJVog7m5GeIG1MGxZnRWcAoNlzj4AyLitx5+khi ZgGHtb6eX192mMVxmAPpd22ERAcNYp1+hnMvWnoYNh9K8cWZ/WNoESLHM2l6Iw3tWL4i okN7REhnJpDtog6hgeVx6fzcrLAkiIxP6NmcfP9rchjsJCp6CEFWqtq4WIq7ctjUaKJy NOLw== X-Received: by 10.15.110.8 with SMTP id cg8mr13526120eeb.42.1390580953908; Fri, 24 Jan 2014 08:29:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.8.196 with HTTP; Fri, 24 Jan 2014 08:28:53 -0800 (PST) From: Fabrice Popineau Date: Fri, 24 Jan 2014 17:28:53 +0100 Message-ID: Content-Type: multipart/alternative; boundary=089e0168156eca0a8d04f0b9db1d X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --089e0168156eca0a8d04f0b9db1d Content-Type: text/plain; charset=ISO-8859-1 I forgot to add that the previous report happens when compiling with '-O2 -g' or with '-O3 -g'. If I use '-O0 -g' and no patch, then I get : Test bool-vector-count-population-1-nil backtrace: (if (unwind-protect (setq value-67354 (apply fn-67352 args-67353)) ( (let (form-description-67356) (if (unwind-protect (setq value-67354 (let ((value-67354 (quote ert-form-evaluation-aborted-67355))) (let (let ((fn-67352 (function eql)) (args-67353 (list (bool-vector-count (let* ((bv (make-bool-vector 45 nil))) (aset bv 40 t) (aset bv 0 t) (lambda nil (let* ((bv (make-bool-vector 45 nil))) (aset bv 40 t) (a #[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\317\320%DC funcall(#[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\31 ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc #[0 "r\304 q\210\305 )\306\307\310\311\312\313!\314\"\315\316%DC\2 funcall(#[0 "r\304 q\210\305 )\306\307\310\311\312\313!\314\"\315\ ert-run-test([cl-struct-ert-test bool-vector-count-population-1-nil ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test a ert-run-tests(t #[385 "\306\307\"\203D\211\211G\310U\203\211@\20 ert-run-tests-batch(nil) ert-run-tests-batch-and-exit() command-line-1(("-L" ";." "-l" "./add-log-tests.el" "-l" "./advice-t command-line() normal-top-level() Which is not good either. Fabrice --089e0168156eca0a8d04f0b9db1d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I forgot to add that the previous report happens when comp= iling with '-O2 -g' or with '-O3 -g'.

If= I use '-O0 -g' and no patch, then I get :

Test bool-vector-count-population-1-nil backtrace:
=A0 (if (= unwind-protect (setq value-67354 (apply fn-67352 args-67353)) (
= =A0 (let (form-description-67356) (if (unwind-protect (setq value-67354
=A0 (let ((value-67354 (quote ert-form-evaluation-aborted-67355))) (le= t
=A0 (let ((fn-67352 (function eql)) (args-67353 (list (bool-vec= tor-count
=A0 (let* ((bv (make-bool-vector 45 nil))) (aset bv 40 = t) (aset bv 0 t)
=A0 (lambda nil (let* ((bv (make-bool-vector 45 nil))) (aset bv 40 t) = (a
=A0 #[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316= \"\317\320%DC
=A0 funcall(#[0 "\306\307!r\211q\210\310\= 311\312\313\314\315!\316\"\31
=A0 ert--run-test-internal([cl-struct-ert--test-execution-info [cl-str= uc
=A0 #[0 "r\304 q\210\305 )\306\307\310\311\312\313!\314\&= quot;\315\316%DC\2
=A0 funcall(#[0 "r\304 q\210\305 )\306\30= 7\310\311\312\313!\314\"\315\
=A0 ert-run-test([cl-struct-ert-test bool-vector-count-population-1-ni= l
=A0 ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-e= rt-test a
=A0 ert-run-tests(t #[385 "\306\307\"\203D\21= 1\211G\310U\203\211@\20
=A0 ert-run-tests-batch(nil)
=A0 ert-run-tests-batch-and-exi= t()
=A0 command-line-1(("-L" ";." "-l&qu= ot; "./add-log-tests.el" "-l" "./advice-t
=A0 command-line()
=A0 normal-top-level()

Which is not good either.

Fabrice
--089e0168156eca0a8d04f0b9db1d-- From unknown Sat Aug 16 14:26:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16535: Compiler bug ? References: In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jan 2014 21:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Fabrice Popineau Cc: 16535@debbugs.gnu.org Received: via spool by 16535-submit@debbugs.gnu.org id=B16535.139059752911283 (code B ref 16535); Fri, 24 Jan 2014 21:06:01 +0000 Received: (at 16535) by debbugs.gnu.org; 24 Jan 2014 21:05:29 +0000 Received: from localhost ([127.0.0.1]:34905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6nwO-0002vv-Nx for submit@debbugs.gnu.org; Fri, 24 Jan 2014 16:05:28 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:51524) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6nwM-0002vk-QT for 16535@debbugs.gnu.org; Fri, 24 Jan 2014 16:05:27 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 0876E39E8011; Fri, 24 Jan 2014 13:05:26 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id caWGbF+pn1D9; Fri, 24 Jan 2014 13:05:25 -0800 (PST) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id AFF6739E8008; Fri, 24 Jan 2014 13:05:25 -0800 (PST) Message-ID: <52E2D595.10607@cs.ucla.edu> Date: Fri, 24 Jan 2014 13:05:25 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.9 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) There's an obvious bug there: a negated-comparison typo, which I fixed in trunk bzr 116147. This raises another point. The bug was triggered because BITS_PER_ULL < BITS_PER_BITS_WORD. The former should be the number of bits in 'unsigned long long' (or 'unsigned long' on platforms that lack that), the latter the number of bits in 'size_t'. I don't know of any platform where the former is less than the latter, so I worry that there's a misconfiguration problem here, which might cause some other subtle bugs on your platform. Can you please give more details about your platform, and how you built Emacs, and the values of BITS_PER_BITS_WORD, HAVE_UNSIGNED_LONG_LONG_INT, BITS_PER_ULL, BITS_WORD_MAX, and ULL_MAX on your platform? GDB should be able to tell you those values. Thanks. From unknown Sat Aug 16 14:26:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16535: Compiler bug ? Resent-From: Fabrice Popineau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jan 2014 23:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 16535@debbugs.gnu.org Received: via spool by 16535-submit@debbugs.gnu.org id=B16535.139060482328404 (code B ref 16535); Fri, 24 Jan 2014 23:08:02 +0000 Received: (at 16535) by debbugs.gnu.org; 24 Jan 2014 23:07:03 +0000 Received: from localhost ([127.0.0.1]:34960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6pq2-0007O3-Od for submit@debbugs.gnu.org; Fri, 24 Jan 2014 18:07:03 -0500 Received: from mail-ea0-f174.google.com ([209.85.215.174]:48480) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6pq0-0007Nc-1e for 16535@debbugs.gnu.org; Fri, 24 Jan 2014 18:07:00 -0500 Received: by mail-ea0-f174.google.com with SMTP id b10so1265939eae.19 for <16535@debbugs.gnu.org>; Fri, 24 Jan 2014 15:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=8Yp4Ll15NgWbfCzTCY2vHJMpjZtJGDniMl5dy6JNOtQ=; b=zBb6PhndMiE2Kg9InLwXO5JHDeD4saGVhpE6n2+46kMkCMra9r8eXCYWeQm4z3+c1D N+1h0bCMjNQXOjUAPSbFw7DyNHlRGprJu+eFYOmkloClTyopf/xlYj6mMPSrZPLkkuNy GTKPSIjeFxZG5ZskDAzjDRN/Vo+sl2Mfn1FG0DzvDSgaJBEmjWlBSlfOjzr6nFJsiJAM xwVIUoV1vEKneRrLEJfvdRoi1HwFy+tVYabp1RXaCYxesmm3UkLGqVoke78vtAQIQkvI /zQtp5GNjyObifQWZwnmRRaSQchtRDnHAaaKykL6Xfx64jHx/qJqcXOjDGKqDysY230b QiAg== X-Received: by 10.14.113.199 with SMTP id a47mr15112669eeh.41.1390604818836; Fri, 24 Jan 2014 15:06:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.8.196 with HTTP; Fri, 24 Jan 2014 15:06:38 -0800 (PST) In-Reply-To: <52E2D595.10607@cs.ucla.edu> References: <52E2D595.10607@cs.ucla.edu> From: Fabrice Popineau Date: Sat, 25 Jan 2014 00:06:38 +0100 Message-ID: Content-Type: multipart/alternative; boundary=001a1133ae003ff2e204f0bf6a01 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a1133ae003ff2e204f0bf6a01 Content-Type: text/plain; charset=ISO-8859-1 Actually, afaik BITS_PER_ULL == BITS_PER_BITS_WORD Starting program: C:\source\Gnu\emacs\mingw\src/emacs.exe -Q [New Thread 25544.0x113f4] Breakpoint 3, main (argc=2, argv=0xc04880) at emacs.c:702 702 { (gdb) p /d BITS_PER_ULL $1 = 64 (gdb) p /d BITS_PER_BITS_WORD $2 = 64 $ grep HAVE_UNSIGNED config.h #define HAVE_UNSIGNED_LONG_LONG_INT 1 I was at bzr116143. With your change, all the bit vector related the tests pass. Thanks, Fabrice 2014/1/24 Paul Eggert > There's an obvious bug there: a negated-comparison typo, which I fixed in > trunk bzr 116147. > > This raises another point. The bug was triggered because BITS_PER_ULL < > BITS_PER_BITS_WORD. The former should be the number of bits in 'unsigned > long long' (or 'unsigned long' on platforms that lack that), the latter the > number of bits in 'size_t'. I don't know of any platform where the former > is less than the latter, so I worry that there's a misconfiguration problem > here, which might cause some other subtle bugs on your platform. Can you > please give more details about your platform, and how you built Emacs, and > the values of BITS_PER_BITS_WORD, HAVE_UNSIGNED_LONG_LONG_INT, > BITS_PER_ULL, BITS_WORD_MAX, and ULL_MAX on your platform? GDB should be > able to tell you those values. Thanks. > --001a1133ae003ff2e204f0bf6a01 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Actually, afaik BITS_PER_ULL =3D=3D BITS_PER_BITS_WORD
Starting program: C:\source\Gnu\emacs\mingw\src/emacs.= exe -Q
[New Thread 25544.0x113f4]

Breakp= oint 3, main (argc=3D2, argv=3D0xc04880) at emacs.c:702
702 =A0 =A0 {
(gdb) p /d BITS_PER_ULL
$1 =3D 64
(gdb) p /d BITS_PER_BITS_WORD
$2 =3D 64

$ grep HAVE_UNSIGNED config.h
#define HAVE_UNS= IGNED_LONG_LONG_INT 1

I was at bzr116143.
With your change, a= ll the bit vector related the tests pass.

Thanks,<= /div>

Fabrice


2014/1/24 Paul Eggert <eggert@cs.ucla.edu&= gt;
There's an obvious bug there: a negated-comparison typo, which I fixed = in trunk bzr 116147.

This raises another point. The bug was triggered because BITS_PER_ULL < = BITS_PER_BITS_WORD. The former should be the number of bits in 'unsigne= d long long' (or 'unsigned long' on platforms that lack that), = the latter the number of bits in 'size_t'. I don't know of any = platform where the former is less than the latter, so I worry that there= 9;s a misconfiguration problem here, which might cause some other subtle bu= gs on your platform. Can you please give more details about your platform, = and how you built Emacs, and the values of BITS_PER_BITS_WORD, HAVE_UNSIGNE= D_LONG_LONG_INT, BITS_PER_ULL, BITS_WORD_MAX, and ULL_MAX on your platform?= GDB should be able to tell you those values. Thanks.

--001a1133ae003ff2e204f0bf6a01-- From unknown Sat Aug 16 14:26:41 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Fabrice Popineau Subject: bug#16535: closed (Re: Compiler bug ?) Message-ID: References: <52E2F8B9.7080101@cs.ucla.edu> X-Gnu-PR-Message: they-closed 16535 X-Gnu-PR-Package: emacs Reply-To: 16535@debbugs.gnu.org Date: Fri, 24 Jan 2014 23:36:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1390606562-31252-1" This is a multi-part message in MIME format... ------------=_1390606562-31252-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #16535: Compiler bug ? which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 16535@debbugs.gnu.org. --=20 16535: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D16535 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1390606562-31252-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 16535-done) by debbugs.gnu.org; 24 Jan 2014 23:35:26 +0000 Received: from localhost ([127.0.0.1]:34964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6qHW-00087B-9N for submit@debbugs.gnu.org; Fri, 24 Jan 2014 18:35:26 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:59123) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6qHS-000871-VH for 16535-done@debbugs.gnu.org; Fri, 24 Jan 2014 18:35:23 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 1E8F239E8014; Fri, 24 Jan 2014 15:35:22 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QOxRBivKOuvS; Fri, 24 Jan 2014 15:35:21 -0800 (PST) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id A735639E8008; Fri, 24 Jan 2014 15:35:21 -0800 (PST) Message-ID: <52E2F8B9.7080101@cs.ucla.edu> Date: Fri, 24 Jan 2014 15:35:21 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Fabrice Popineau Subject: Re: Compiler bug ? References: <52E2D595.10607@cs.ucla.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 16535-done Cc: 16535-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) On 01/24/2014 03:06 PM, Fabrice Popineau wrote: > Actually, afaik BITS_PER_ULL == BITS_PER_BITS_WORD Ah, OK, thanks for following up. It looks like the negated-comparison bug caused undefined behavior due to integer overflow in count_one_bits_word; once that happens it's anybody's guess what compilers will do; maybe you hit the jackpot. Anyway, the Emacs bug is fixed (and there doesn't seem to have been a compiler bug) so I'll close this report. ------------=_1390606562-31252-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Jan 2014 15:04:03 +0000 Received: from localhost ([127.0.0.1]:34666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6iIb-0000mJ-O9 for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:04:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46986) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W6iIY-0000m1-6B for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6iIS-0005AR-Rz for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:03:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6iIS-0005AM-PK for submit@debbugs.gnu.org; Fri, 24 Jan 2014 10:03:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6iIJ-0005Ox-4j for bug-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:03:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6iIE-00058W-Dq for bug-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:03:43 -0500 Received: from mail-ee0-x231.google.com ([2a00:1450:4013:c00::231]:52325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6iIE-00058J-6V for bug-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:03:38 -0500 Received: by mail-ee0-f49.google.com with SMTP id d17so1011374eek.22 for ; Fri, 24 Jan 2014 07:03:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=hjs1n97RGv2j89A89Vlm1GriMb0E1KcVdMn+Z3xdS/o=; b=kJq+Gr33T6kGLBBQQd6wRA3Vkz16K8cm03rshOKJV0BoY4TPNAXwwIsM9+hvkdClFb 0F+KUw2jqp/v9d+w/AY50gGDkimJ35lRrN5iWPDyqGsswRVkXHChAVtoo5q12B2BcKDz DpllfDZQb4EYdonZWMwYm42eRCsCBp96Zu5l3aQ/OrRbE9kRB5SycT+BoKHI22cfMAJk Sty8xdHa41Dw6N0R7dXpPAA+sHZlXLDwHETrANtZv6xYt4nAv6PZAeebP1nyuCE74LbU 0MjCvG/I0o48n1Jh32QhWJmNRQhlncTNn4iA8vejtmWkOVDhvpHwXQA/N7TPEmULJS3D RuOw== X-Received: by 10.15.110.133 with SMTP id ch5mr186637eeb.112.1390575817243; Fri, 24 Jan 2014 07:03:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.8.196 with HTTP; Fri, 24 Jan 2014 07:03:17 -0800 (PST) From: Fabrice Popineau Date: Fri, 24 Jan 2014 16:03:17 +0100 Message-ID: Subject: Compiler bug ? To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=089e016354ac9ec17004f0b8a90d X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --089e016354ac9ec17004f0b8a90d Content-Type: text/plain; charset=ISO-8859-1 I hit a bug while compiling Gnu Emacs trunk development. The following test : passed 17/1152 bool-vector-count-population-1-nil fails unless I apply the following patch : === modified file 'src/data.c' --- src/data.c 2014-01-03 06:47:27 +0000 +++ src/data.c 2014-01-24 14:59:16 +0000 @@ -3012,8 +3012,10 @@ { int i = 0, count = 0; while (count += count_one_bits_ll (w), - BITS_PER_BITS_WORD <= (i += BITS_PER_ULL)) + BITS_PER_BITS_WORD <= i) { + i += BITS_PER_ULL; w = shift_right_ull (w); + } return count; } } This is with : $ gcc --version gcc.exe (Rev6, Built by MSYS2 project) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Given the nature of the patch, I don't think it is specific of th MinGW64 gcc version. Regards, Fabrice Popineau --089e016354ac9ec17004f0b8a90d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I hit a bug while compiling Gnu Emacs trunk development.
The following test :
=A0passed =A0 =A017/1= 152 =A0bool-vector-count-population-1-nil
fails unless I ap= ply the following patch :

=A0=3D=3D=3D modified file 'src/data.c'
--- src/data.c =A02014-01-03 06:47:27 +0000
+++ src/data.= c =A02014-01-24 14:59:16 +0000
@@ -3012,8 +3012,10 @@
= =A0 =A0 =A0{
=A0 =A0 =A0 =A0int i =3D 0, count =3D 0;
=A0 =A0 =A0 =A0whil= e (count +=3D count_one_bits_ll (w),
- =A0 =A0 =A0 =A0 =A0 =A0BIT= S_PER_BITS_WORD <=3D (i +=3D BITS_PER_ULL))
+ =A0 =A0 =A0 =A0 = =A0 =A0BITS_PER_BITS_WORD <=3D i) {
+ =A0 =A0 =A0 i +=3D BITS_PER_ULL;
=A0 =A0 =A0 =A0 w =3D shift_ri= ght_ull (w);
+ =A0 =A0 =A0}
=A0 =A0 =A0 =A0return count= ;
=A0 =A0 =A0}
=A0}

This= is with :
$ gcc --version
gcc.exe (Rev6, Built by MSYS2 project) 4.8.2
Copyright (C) 2= 013 Free Software Foundation, Inc.
This is free software; see the= source for copying conditions. =A0There is NO
warranty; not even= for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Given the nature of the patch, I don't think = it is specific of th MinGW64 gcc version.

Regards,=

Fabrice Popineau=A0
--089e016354ac9ec17004f0b8a90d-- ------------=_1390606562-31252-1--