Josh Huber <huber(a)alum.wpi.edu> writes:
 Given this defun:
 (defun jmh-test-func ()
   (let (tv)
     (setq tv '((?a) (?b)))
     (push "testme" (cdr (assoc ?a tv)))
     tv)) 
That defun is undefined behavior; it's not allowed to modify a
constant list.  Here is the correct version:
    (defun jmh-test-func ()
      (let (tv)
        (setq tv (list (list ?a) (list ?b)))
        (push "testme" (cdr (assoc ?a tv)))
        tv))
What you did is in spirit similar to writing this C code:
    /* Return the string "foobar" with a one-character modification: */
    foo(int ind, char c)
    {
      char *p = "foobar";
      p[ind] = c;
      return strdup (p);
    }
"foobar" is allocated only once, and so is '((?a) (?b)), at least in a
compiled environment.