[ clisp-Bugs-3598754 ] sort + union destroys underlying union members

SourceForge.net <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
Bugs item #3598754, was opened at 2012-12-28 07:17
Message generated for change (Comment added) made by sds
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3598754&group_id=1355

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: clisp
>Group: ANSI compliance issue
>Status: Pending
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: winfriedp (wplapper-2)
>Assigned to: Sam Steingold (sds)
Summary: sort + union destroys underlying union members

Initial Comment:
sorting a union destroys the underlying elements. I am using 'union' and not 'nunion'.

(defconstant *NEIGHBOURS2*  (map 'simple-vector #'(lambda(cell)
  (multiple-value-bind (r c b) (lin2rcbmvb cell)
    (sort (copy-seq
    (remove cell (union (union (svref *UNIT-LIST-VL2* r)
                               (svref *UNIT-LIST-VL2* c))
                        (svref *UNIT-LIST-VL2* b))))
    #'<))) *CELLS*))
Without forcing an additional coy via copy-seq, some of *UNIT-LIST-VL2* gets modified.

Base info: Kubuntu 12.10, uname -a: Linux kunbuntu-x64 3.5.0-21-generic #32-Ubuntu SMP Tue Dec 11 18:51:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

clisp --version
GNU CLISP 2.49 (2010-07-07) (built on allspice.buildd [127.0.1.1])
Software: GNU C 4.6.2 
gcc -falign-functions=4 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O -falign-functions=4 -DENABLE_UNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -I. -Wl,-Bsymbolic-functions -Wl,-z,relro  -lreadline -lncurses -ldl /usr/lib/libavcall.so /usr/lib/libcallback.so  -L/usr/lib -lsigsegv libgnu_cl.a 
SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.9
libreadline 5.2
libffcall 1.11
Features: 
(READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI GETTEXT UNICODE
 BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp readline)
Installation directory: /usr/lib/clisp-2.49/
User language: ENGLISH
Machine: X86_64 (X86_64) kunbuntu-x64 [127.0.1.1]

I am building the structures *UNIT-LIST-VLx* and *NEIGHBOURSx* twice, in order to show the desctructive behaviour of sort.
SBCL and CCL do the right thing for me.

----------------------------------------------------------------------

>Comment By: Sam Steingold (sds)
Date: 2012-12-28 08:02

Message:
this behavior is fully ANSI compliant.
UNION does NOT modify its arguments, but its return value MAY share
structure with them.
An alternative to your approach is copying the arguments to UNION and using
NUNION.

----------------------------------------------------------------------

Comment By: Sam Steingold (sds)
Date: 2012-12-28 08:02

Message:
This bug report is now marked as "pending"/"invalid".
This means that we think that the problem you report is not a problem with
CLISP.
Unless you - the reporter - act within 2 weeks, the bug will be permanently
closed.
Sorry about the inconvenience - we hope your silence means that you agree
that this is not a bug in CLISP.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3598754&group_id=1355

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.