From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#29799: 24.5; cl-loop guard clause missing Date: Thu, 21 Dec 2017 18:38:20 +0900 Message-ID: <87d138beur.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1513849039 19998 195.159.176.226 (21 Dec 2017 09:37:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Dec 2017 09:37:19 +0000 (UTC) Cc: monnier@iro.umontreal.ca, npostavs@gmail.com To: 29799@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 21 10:37:15 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRxHu-0004ip-Kv for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Dec 2017 10:37:14 +0100 Original-Received: from localhost ([::1]:41787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRxJp-0003K0-Qd for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Dec 2017 04:39:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRxJj-0003JX-HQ for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2017 04:39:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRxJf-00079u-K8 for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2017 04:39:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRxJf-00079l-GP for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2017 04:39:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eRxJe-00067b-8K; Thu, 21 Dec 2017 04:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, npostavs@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Dec 2017 09:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29799 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca,npostavs@gmail.com Original-Received: via spool by submit@debbugs.gnu.org id=B.151384912123500 (code B ref -1); Thu, 21 Dec 2017 09:39:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Dec 2017 09:38:41 +0000 Original-Received: from localhost ([127.0.0.1]:45211 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRxJJ-00066w-2K for submit@debbugs.gnu.org; Thu, 21 Dec 2017 04:38:41 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47677) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRxJI-00066l-3K for submit@debbugs.gnu.org; Thu, 21 Dec 2017 04:38:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRxJC-0006l3-8w for submit@debbugs.gnu.org; Thu, 21 Dec 2017 04:38:35 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eRxJC-0006kq-5h for submit@debbugs.gnu.org; Thu, 21 Dec 2017 04:38:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRxJA-0003Cb-W4 for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2017 04:38:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRxJ7-0006h8-22 for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2017 04:38:33 -0500 Original-Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:39520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRxJ6-0006gI-Qj for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2017 04:38:28 -0500 Original-Received: by mail-wm0-x22b.google.com with SMTP id i11so14510652wmf.4 for ; Thu, 21 Dec 2017 01:38:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=2TkR1DMfxHBbut4j/NtAHcJsiIonaG6dcTVK4iQms+s=; b=H7t6ZRsLfGhLSSs2NdaPAfcj2FDknYguPEHq25fB9s29N+DQ3wwsd29sMRMhmQe7t7 4A46Ha+YRvjnxFLosf+4PY05myMh2gz6zyhBsoR8WCILCFPXFN/AIYjY/ll8T5QMj8SF kGelf/fRmPB+ZMHoEfISvj4W9JeVqydgXv4yIEokPTfHRmJaUm359M2s3KH4PMCux2A0 JzgcNpmTyKXOEHlvQDVtHUq2xVSHAuAgILnF0DQoi1SAyF1I07IkzOBUooyN1luOqq2f bwsIf9POeS4TFHXKUiwreEPr2fuivK97xslCvJ8K66UyzC08ko1TM9O960r2wBxiD417 jDnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=2TkR1DMfxHBbut4j/NtAHcJsiIonaG6dcTVK4iQms+s=; b=bYUu0yi1n92pMRuCkj3XBt9SkYTjrLYPJMG0nw5SXyrdCNnifTI/4JPcV5nn/NPpEH DJ3iZGKIkl6SRrwlyEB2s5O37M39QUvTRIgVlWE/6QJaQWZ/cLdo7ezXSih5cC6eUCJr /ytjuV4tK2ISNvS6pyiJ1BUXos6Ti8dEP5aUiGM1Ho0iz4tsG9IjaqxwRkHBUrMhAgQ+ d4vKCVd+Kj3tF3csy18O5tIAddfYvv+l4hqhSyqhSvc+ZK1lI9K+NDFsjwTDdUxvlL7A ikVmLxqjK73ZS7BGNwvY8kjqUmSRbdb5LqyCaohjC9o+O4HgPCM7u78BxIzMNayl6hiG et9Q== X-Gm-Message-State: AKGB3mIYOdHlBC2LQjJA6QaSj6CQsg39xj4NDiL55YcVc6z2kkz7Jr9k nWzRu+nXENeItm5i5h95+SigYQ== X-Google-Smtp-Source: ACJfBovMbpW4Q7hf7gyFrdDeZC8PPUp3WzMnpUyJbCnIuBB0GxaAEgfdnLtTEp9XW/RSfVC8LDEV2w== X-Received: by 10.28.220.215 with SMTP id t206mr8756853wmg.75.1513849107043; Thu, 21 Dec 2017 01:38:27 -0800 (PST) Original-Received: from calancha-pc (228.red-83-40-68.dynamicip.rima-tde.net. [83.40.68.228]) by smtp.gmail.com with ESMTPSA id a23sm3974846wra.70.2017.12.21.01.38.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Dec 2017 01:38:26 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141327 Archived-At: X-Debbugs-CC: monnier@iro.umontreal.ca,npostavs@gmail.com Consider the following snippet code: --8<-----------------------------cut here---------------start------------->8--- (require 'cl-lib) (let* ((size 7) (arr (make-vector size 0))) (cl-loop for k below size for x = (* 2 k) and y = (1+ (elt arr k)) collect (list k x y))) --8<-----------------------------cut here---------------end--------------->8--- When you execute the form above it fails because the loop overrun `arr'. The equivalent code in CL works: --8<-----------------------------cut here---------------start------------->8--- (let* ((size 7) (arr (make-array size :initial-element 0))) (loop :for k :below size :for x = (* 2 k) :and y = (1+ (elt arr k)) :collect (list k x y))) --8<-----------------------------cut here---------------end--------------->8--- * The expansion of `loop' in CL checks the condition (>= k 7) right before update the internal variables (`x' and `y'). * The expansion of `cl-loop' instead, doesn't check the condition before update the vars => in the code above we overrun `arr'. In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-12 on hullmann, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11902000 System Description: Debian GNU/Linux 9.3 (stretch)