all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: unic0rn <mirek.kaim@gmail.com>
To: emacs-devel@gnu.org
Subject: a bug - probably in llvm - prevents emacs from building with clang 3.4
Date: Sun, 19 Jan 2014 06:39:38 +0100	[thread overview]
Message-ID: <CANStjuk3+8Zfs2DWCjn44Kt46+0HrTr9YCz653o=VQpXM79h2g@mail.gmail.com> (raw)

editfns.c gets miscompiled at -O > 0, causing emacs to crash.

backtrace:

(gdb) run
Starting program: /y/build/emacs/src/temacs --batch --load loadup bootstrap
[New Thread 3728.0x10dc]
[New Thread 3728.0x10c0]
Loading loadup.el (source)...
Using load-path (/y/emacs/lisp /y/emacs/lisp/emacs-lisp
/y/emacs/lisp/language /y/emacs/lisp/international
/y/emacs/lisp/textmodes /y/emacs/lisp/vc)
[New Thread 3728.0xdd4]
Loading emacs-lisp/byte-run (source)...
Loading emacs-lisp/backquote (source)...
Loading subr (source)...
Loading version (source)...

Program received signal SIGSEGV, Segmentation fault.
strftime_case_ (upcase=false, s=0x228f00 "\001\212\210",
    maxsize=<optimized out>, format=0x0, tp=0xa, ut=<optimized out>,
    ns=<optimized out>) at ../../../emacs/lib/strftime.c:507
507       for (f = format; *f != '\0'; ++f)
(gdb) backtrace
#0  strftime_case_ (upcase=false, s=0x228f00 "\001\212\210",
    maxsize=<optimized out>, format=0x0, tp=0xa, ut=<optimized out>,
    ns=<optimized out>) at ../../../emacs/lib/strftime.c:507
#1  0x005a80c2 in nstrftime (s=0x228f00 "\001\212\210", maxsize=0, format=0x0,
    tp=0x61256e80 <tm>, ut=1, ns=484375000)
    at ../../../emacs/lib/strftime.c:1449
#2  0x00513ef0 in format_time_string (format=0x0, formatlen=0, t=...,
    ut=<optimized out>, tmp=<optimized out>)
    at ../../../emacs/src/editfns.c:1672
#3  0x00513d44 in Fformat_time_string (format_string=<optimized out>,
    timeval=2268888, universal=<optimized out>)
    at ../../../emacs/src/editfns.c:1756
#4  0x0051d61c in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2182
#5  0x0051d429 in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2140
#6  0x0051e6e1 in Flet (args=<optimized out>) at ../../../emacs/src/eval.c:937
#7  0x0051d397 in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2124
#8  0x0052175b in funcall_lambda (fun=<optimized out>, nargs=<optimized out>,
    arg_vector=<optimized out>) at ../../../emacs/src/eval.c:459
#9  0x00520346 in apply_lambda (fun=9104334, args=<optimized out>)
    at ../../../emacs/src/eval.c:2915
---Type <return> to continue, or q <return> to quit---
#10 0x0051d53d in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2221
#11 0x0052030b in apply_lambda (fun=9361006, args=<optimized out>)
    at ../../../emacs/src/eval.c:2906
#12 0x0051d53d in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2221
#13 0x0051d429 in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2140
#14 0x0051d4d9 in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2161
#15 0x0053e568 in readevalloop (readcharfun=8496874,
    stream=0x864080 <bss_sbrk_buffer+671560>, sourcename=<optimized out>,
    printflag=<optimized out>, unibyte=<optimized out>, readfun=8130560,
    start=<optimized out>, end=<optimized out>)
    at ../../../emacs/src/lread.c:1934
#16 0x0053d3f4 in Fload (file=<optimized out>, noerror=<optimized out>,
    nomessage=<optimized out>, nosuffix=<optimized out>,
    must_suffix=<optimized out>) at ../../../emacs/src/lread.c:1370
#17 0x0051d675 in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2190
#18 0x0053e568 in readevalloop (readcharfun=8496874,
    stream=0x864010 <bss_sbrk_buffer+671448>, sourcename=<optimized out>,
    printflag=<optimized out>, unibyte=<optimized out>, readfun=8130560,
---Type <return> to continue, or q <return> to quit---
    start=<optimized out>, end=<optimized out>)
    at ../../../emacs/src/lread.c:1934
#19 0x0053d3f4 in Fload (file=<optimized out>, noerror=<optimized out>,
    nomessage=<optimized out>, nosuffix=<optimized out>,
    must_suffix=<optimized out>) at ../../../emacs/src/lread.c:1370
#20 0x0051d675 in eval_sub (form=<optimized out>)
    at ../../../emacs/src/eval.c:2190
#21 0x005200d7 in Feval (form=8430502, lexical=<optimized out>)
    at ../../../emacs/src/eval.c:1994
#22 0x004bd1bd in top_level_2 () at ../../../emacs/src/keyboard.c:1179
#23 0x0051f4af in internal_condition_case (bfun=0x77e170 <pbm_format+676>,
    handlers=<optimized out>, hfun=<optimized out>)
    at ../../../emacs/src/eval.c:1345
#24 0x004bd183 in top_level_1 (ignore=8450074)
    at ../../../emacs/src/keyboard.c:1187
#25 0x0051ee24 in internal_catch (tag=<optimized out>, func=0x0, arg=7856496)
    at ../../../emacs/src/eval.c:1109
#26 0x004ac41a in recursive_edit_1 () at ../../../emacs/src/keyboard.c:1148
#27 0x004ac5d5 in Frecursive_edit () at ../../../emacs/src/keyboard.c:841
#28 0x004ab10a in main (
    argc=<error reading variable: Cannot access memory at address 0x0>,
    argv=<optimized out>) at ../../../emacs/src/emacs.c:1637
(gdb)

exact steps to reproduce:
http://aurora.irc.arloria.net/~unic0rn/emacs_clang_optimization_bug.html

my workaround is kinda silly, but at least it works. i've tried to
modify editfns.c to trick llvm's optimizers into generating something
that will work, to no avail. it seems like the first param doesn't end
up on the stack somehow. since llvm/clang 3.4 is a current release
version, i guess it'll land on osx and freebsd sooner than later, and
if they won't fix that until then - well, it may cause some problems.
unfortunately, i can't test it with higher -march settings, because my
cpu doesn't even support SSE2.

i've filled a bug for llvm, but i'm not sure how far it'll go:
http://llvm.org/bugs/show_bug.cgi?id=18537



                 reply	other threads:[~2014-01-19  5:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANStjuk3+8Zfs2DWCjn44Kt46+0HrTr9YCz653o=VQpXM79h2g@mail.gmail.com' \
    --to=mirek.kaim@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.