aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-08-02 15:58:09 -0700
committerPaul Eggert2014-08-02 15:58:09 -0700
commita98a91ac4697c50b3ebb188c279b08b7799e6e3d (patch)
treeabdec80c705b4bfe6bc3153030b0b3f919d62e69 /src
parent7f0ff25b7a056570e2435a88b9bb736501aaa12b (diff)
downloademacs-a98a91ac4697c50b3ebb188c279b08b7799e6e3d.tar.gz
emacs-a98a91ac4697c50b3ebb188c279b08b7799e6e3d.zip
Fix bug with clang + directory_files_internal + GC.
* src/dired.c (directory_files_internal): Use a volatile variable to prevent the compiler from optimizing away all copies of a local. I wonder how many other GC-related bugs like this lurk elsewhere? Fixes: debbugs:16986
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/dired.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b85aee0d35a..93c27a6e565 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12014-08-02 Paul Eggert <eggert@cs.ucla.edu> 12014-08-02 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Fix bug with clang + directory_files_internal + GC (Bug#16986).
4 * dired.c (directory_files_internal): Use a volatile variable
5 to prevent the compiler from optimizing away all copies of a local.
6 I wonder how many other GC-related bugs like this lurk elsewhere?
7
3 Avoid 100% CPU utilization on ssh session exit (Bug#17691). 8 Avoid 100% CPU utilization on ssh session exit (Bug#17691).
4 * xterm.h (struct x_display_info): New member 'connection'. 9 * xterm.h (struct x_display_info): New member 'connection'.
5 * xterm.c (x_term_init, x_delete_terminal): Set and use it, 10 * xterm.c (x_term_init, x_delete_terminal): Set and use it,
diff --git a/src/dired.c b/src/dired.c
index 55b2f6658c7..c2db1f02782 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -150,6 +150,12 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
150 Lisp_Object w32_save = Qnil; 150 Lisp_Object w32_save = Qnil;
151#endif 151#endif
152 152
153 /* Don't let the compiler optimize away all copies of DIRECTORY,
154 which would break GC; see Bug#16986. Although this is required
155 only in the common case where GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS,
156 it shouldn't break anything in the other cases. */
157 Lisp_Object volatile directory_volatile = directory;
158
153 /* Because of file name handlers, these functions might call 159 /* Because of file name handlers, these functions might call
154 Ffuncall, and cause a GC. */ 160 Ffuncall, and cause a GC. */
155 list = encoded_directory = dirfilename = Qnil; 161 list = encoded_directory = dirfilename = Qnil;
@@ -325,6 +331,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
325 list = Fsort (Fnreverse (list), 331 list = Fsort (Fnreverse (list),
326 attrs ? Qfile_attributes_lessp : Qstring_lessp); 332 attrs ? Qfile_attributes_lessp : Qstring_lessp);
327 333
334 (void) directory_volatile;
328 RETURN_UNGCPRO (list); 335 RETURN_UNGCPRO (list);
329} 336}
330 337