unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lektu@mi.madritel.es>
Subject: Re: display word wrapping
Date: Sun, 30 May 2004 18:50:27 +0200	[thread overview]
Message-ID: <20040530175117.C69B.LEKTU@mi.madritel.es> (raw)
In-Reply-To: <uy8nacujq.fsf@gnu.org>

On 30 May 2004 08:12:41 +0200, Eli Zaretskii <eliz@gnu.org> wrote:

> Does it crash (it _is_ a crash, isn't it?) under a debugger, or does
> that, too, cause the bug to change its behavior?

Yes, it is a crash. No, it fails the same way under debugging.

> If the former, run an unmodified optimized code under a debugger and
> use debugger facilities instead of debugging code to see what's wrong.

Yeah, I've already tried, and I see *where* it is failing, but debugging
optimized code is a bit of a pain.

> Comparison of machine code in the optimized and unoptimized versions
> might also tell you something useful.

It would, if I were more sure about what the code is exactly supposed to
do. I'm no expert in the image code.

> Finally, assuming that we are talking about a crash, posting the
> detailed description of the crash (exception number, register dump,
> stack dump, etc.) here could give some further ideas.

When I try to load a 811-byte .gif, I get:

  Unhandled exception at 0x0106dd08 in emacs.exe: 0xC0000005: Access
  violation reading location 0x00000004.

The stack trace is:

  image_spec_value(int spec=-536870912, int key=557610632, int * found=0x00000000) Line 931 + 0x8	C
  lookup_image(frame * f=0x015dbe00, int spec=-1572937664) Line 1682	C
  handle_single_display_prop(it * it=0x00000000, int prop=5, int object=-2109577216, text_pos * position=0x0082f04c, int display_replaced_before_p=0) Line 3702	C
  handle_display_prop(it * it=0x0082f04c) Line 3339 + 0x10	C
  handle_stop(it * it=0x0082efb0) Line 2591 + 0x3	C
  reseat(it * it=0x00000000, text_pos pos={...}, int force_p=1) Line 4676 + 0x6	C
  init_iterator(it * it=0x0082efb0, window * w=0x015dbe00, int charpos=1, int bytepos=1, glyph_row * row=0x02426800, face_id base_face_id=DEFAULT_FACE_ID) Line 2269 + 0x18	C
  start_display(it * it=0x0082efb0, window * w=0x0211ac00, text_pos pos={...}) Line 2288 + 0x1f	C
  try_window(int window=-2112771072, text_pos pos={...}) Line 12211 + 0x20	C
  redisplay_window(int window=-2112771072, int just_this_one_p=0) Line 11858 + 0xc	C
  redisplay_window_0(int window=-2112771072) Line 10588 + 0xa	C
  internal_condition_case_1(int (void)* bfun=0x0103fbcb, int arg=-2112771072, int handlers=-1589824248, int (void)* hfun=0x01029d11) Line 1374 + 0x35	C
  redisplay_windows(int window=-2112771072) Line 10569 + 0x1d	C
  redisplay_internal(int preserve_echo_area=0) Line 10152 + 0x8	C
  redisplay() Line 9386 + 0x7	C
  read_char(int commandflag=1, int nmaps=5, int * maps=0x0082fbec, int prev_event=557609984, int * used_mouse_menu=0x0082fc44) Line 2487	C
  read_key_sequence(int * keybuf=0x0082fce8, int bufsize=30, int prompt=557609984, int dont_downcase_last=0, int can_return_switch_frame=1, int fix_current_buffer=1) Line 8783 + 0x24	C
  command_loop_1() Line 1490 + 0x25	C
  internal_condition_case(int (void)* bfun=0x0105b380, int handlers=557688384, int (void)* hfun=0x01058003) Line 1334	C
  command_loop_2() Line 1271 + 0x15	C
  internal_catch(int tag=557684672, int (void)* func=0x0105c094, int arg=557609984) Line 1094 + 0x6	C
  command_loop() Line 1251	C
  recursive_edit_1() Line 961 + 0x5	C
  Frecursive_edit() Line 1023	C
  main() Line 1693 + 0x5	C
  mainCRTStartup() Line 259 + 0x12	C
  GetCurrentDirectoryW() + 0x44	

lookup_image is calling image_spec_value with the following code:

	  if (! img->background_valid)
	    {
	      bg = image_spec_value (img->spec, QCbackground, NULL);
	      if (!NILP (bg))
		{
		  img->background
		    = x_alloc_image_color (f, img, bg,
					   FRAME_BACKGROUND_PIXEL (f));
		  img->background_valid = 1;
		}
	    }

At that point, img->spec is not valid. Previously, img has been
initialized from spec (the arg passed to the function), so spec and
img->spec should be equal, but they aren't anymore. If you change the
call to do

 bg = image_spec_value (spec, QCbackground, NULL);

it succeeds, but then the call to postprocess_image

	  if (!EQ (*img->type->type, Qpostscript))
	    postprocess_image (f, img);

fails for the same reason (img->spec is not valid).

On optimized code, img is not on the stack, but on a register. In fact,
if I change

  struct image *img;

to

  static struct image *img;

Emacs works fine. So it looks like it *is* really a bug in the optimizer
code, which is clobbering a register or something like that.


                                                           /L/e/k/t/u

  reply	other threads:[~2004-05-30 16:50 UTC|newest]

Thread overview: 174+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-26 10:02 display word wrapping Miles Bader
2004-05-26 10:53 ` Kai Grossjohann
2004-05-26 11:29 ` Kim F. Storm
2004-05-26 12:54   ` Miles Bader
2004-05-26 14:50     ` David Kastrup
2004-05-26 15:06       ` Kim F. Storm
2004-05-26 19:16         ` David Kastrup
2004-05-26 19:50           ` Miles Bader
2004-05-26 21:43             ` i-search face-cache crash [was Re: display word wrapping] Kim F. Storm
2004-05-27  0:12               ` Miles Bader
2004-05-27  8:33                 ` Kim F. Storm
2004-05-27  4:48               ` i-search face-cache crash Miles Bader
2004-05-27 23:54                 ` Richard Stallman
2004-05-26 20:58           ` display word wrapping Kim F. Storm
2004-05-27  7:31             ` Jason Rumney
2004-05-26 22:21           ` Luc Teirlinck
2004-05-27  5:59           ` Miles Bader
2004-05-26 19:45         ` Miles Bader
2004-05-26 21:01           ` Kim F. Storm
2004-05-26 21:33             ` Miles Bader
2004-05-26 21:55               ` Kim F. Storm
2004-05-27  0:38                 ` Miles Bader
2004-05-26 21:52           ` Stefan Monnier
2004-05-27 23:53           ` Richard Stallman
2004-05-27  9:08         ` Juanma Barranquero
2004-05-27 10:41           ` Kim F. Storm
2004-05-27 11:15             ` Juanma Barranquero
2004-05-28  7:57               ` Jason Rumney
2004-05-28  8:24                 ` Kim F. Storm
2004-05-28  9:36                 ` Juanma Barranquero
2004-05-29 20:54                 ` Juanma Barranquero
2004-05-30  1:38                   ` Juanma Barranquero
2004-05-30  6:12                     ` Eli Zaretskii
2004-05-30 16:50                       ` Juanma Barranquero [this message]
2004-05-30 18:27                         ` Eli Zaretskii
2004-05-31  0:40                           ` Juanma Barranquero
2004-05-31  7:34                             ` Eli Zaretskii
2004-05-31 14:40                               ` Juanma Barranquero
2004-05-31 15:28                                 ` Andreas Schwab
2004-05-31 17:41                                   ` Eli Zaretskii
2004-06-01  7:14                                     ` Juanma Barranquero
2004-06-01 20:32                                       ` Eli Zaretskii
2004-06-01 20:53                                         ` Andreas Schwab
2004-06-01 23:50                                           ` Juanma Barranquero
2004-06-02  7:58                                             ` Kim F. Storm
2004-06-02  8:25                                               ` Juanma Barranquero
2004-06-02  4:55                                           ` Eli Zaretskii
2004-06-02  7:27                                             ` Juanma Barranquero
2004-05-31 17:55                                 ` Eli Zaretskii
2004-05-31 18:39                                   ` Juanma Barranquero
2004-05-31 19:03                                   ` Juanma Barranquero
2004-05-31 20:19                                     ` Andreas Schwab
2004-05-31 21:36                                       ` Juanma Barranquero
2004-05-31 19:18                                   ` Miles Bader
2004-05-31 20:02                                     ` Juanma Barranquero
2004-05-31 19:09                                 ` Jason Rumney
2004-05-31 15:27                               ` Andreas Schwab
2004-05-31 18:33                                 ` Juanma Barranquero
2004-05-31 19:05                           ` Jason Rumney
2004-05-31 22:19                             ` Juanma Barranquero
2004-06-01  4:43                               ` Eli Zaretskii
2004-06-01  7:16                                 ` Juanma Barranquero
2004-05-28  9:15               ` Benjamin Riefenstahl
2004-05-28  9:48                 ` Juanma Barranquero
2004-05-28  9:24               ` Eli Zaretskii
2004-05-28  9:46                 ` Juanma Barranquero
2004-05-29  1:43                 ` Richard Stallman
2004-05-29 11:37                   ` Eli Zaretskii
2004-05-29 15:07                   ` Juanma Barranquero
2004-05-30 14:30                     ` Richard Stallman
2004-05-30 16:58                       ` Juanma Barranquero
2004-05-31 18:39                         ` Richard Stallman
2004-05-31 18:55                       ` Jason Rumney
2004-06-02 17:36                         ` Richard Stallman
2004-05-31 21:05                 ` David Kastrup
2004-05-27 21:32             ` W32 image support (was Re: display word wrapping) Jason Rumney
2004-05-28 15:54           ` display word wrapping Peter Lee
2004-05-28 21:48             ` Jason Rumney
2004-05-29  3:19             ` Juanma Barranquero
2004-05-29 23:10               ` Kim F. Storm
2004-05-29 23:23                 ` Juanma Barranquero
2004-05-30 19:41                   ` Richard Stallman
2004-05-31 19:12                 ` Jason Rumney
2004-05-31 20:18                   ` Kim F. Storm
2004-06-02 15:04                     ` Juanma Barranquero
2004-06-02 22:17                       ` Jason Rumney
2004-06-02 22:43                         ` Juanma Barranquero
2004-06-03  7:49                           ` Jason Rumney
2004-06-03  8:40                             ` Juanma Barranquero
2004-06-03  9:00                               ` David Kastrup
2004-06-03  9:16                                 ` Juanma Barranquero
2004-06-03  9:26                                   ` David Kastrup
2004-06-03 10:02                                     ` Juanma Barranquero
2004-06-03 12:04                               ` Kim F. Storm
2004-06-03 13:52                                 ` Juanma Barranquero
2004-06-03 20:43                                   ` Kim F. Storm
2004-06-04  1:39                                     ` Juanma Barranquero
2004-06-04  8:07                                       ` Kim F. Storm
2004-06-04  9:09                                         ` Juanma Barranquero
2004-06-04  9:29                                           ` Juanma Barranquero
2004-06-04 12:40                                             ` Kim F. Storm
2004-06-04 12:45                                           ` Kim F. Storm
2004-06-04 13:42                                             ` Juanma Barranquero
2004-06-04 14:16                                               ` Kim F. Storm
2004-06-05  1:20                                                 ` Juanma Barranquero
2004-06-07 12:55                                                   ` Juanma Barranquero
2004-06-07 13:34                                                     ` Kim F. Storm
2004-06-07 16:00                                                       ` Juanma Barranquero
2004-06-07 23:11                                                         ` Kim F. Storm
2004-06-08  0:33                                                           ` Juanma Barranquero
2004-06-08  6:38                                                             ` David Kastrup
2004-06-08  8:06                                                               ` Kim F. Storm
2004-06-08  8:23                                                                 ` David Kastrup
2004-06-08  9:33                                                                   ` Kim F. Storm
2004-06-08  9:54                                                                     ` David Kastrup
2004-06-08 10:02                                                                       ` Juanma Barranquero
2004-06-08 10:10                                                                         ` David Kastrup
2004-06-08 10:24                                                                           ` Juanma Barranquero
2004-06-08 10:43                                                                             ` David Kastrup
2004-06-08 11:17                                                                               ` Juanma Barranquero
2004-06-08 12:08                                                                                 ` Kim F. Storm
2004-06-08 12:22                                                                                   ` Miles Bader
2004-06-08 12:31                                                                                     ` David Kastrup
2004-06-08 11:31                                                                               ` Juanma Barranquero
2004-06-08 11:39                                                                                 ` David Kastrup
2004-06-08 12:11                                                                                   ` Juanma Barranquero
2004-06-08 12:05                                                                                 ` Kim F. Storm
2004-06-08 12:13                                                                                   ` Juanma Barranquero
2004-06-08 10:00                                                                     ` Juanma Barranquero
2004-06-08  8:14                                                               ` Juanma Barranquero
2004-06-02 23:47                         ` Juanma Barranquero
2004-06-03  7:43                           ` Jason Rumney
2004-06-03  7:54                             ` Juanma Barranquero
2004-06-03  9:37                           ` Benjamin Riefenstahl
2004-06-03  9:54                             ` Juanma Barranquero
2004-06-07 11:13                               ` Benjamin Riefenstahl
2004-06-07 13:29                                 ` Juanma Barranquero
2004-06-07 16:37                                   ` Benjamin Riefenstahl
2004-06-01 16:34               ` Peter Lee
2004-06-01 20:43                 ` Eli Zaretskii
2004-06-02  0:05                 ` Juanma Barranquero
2004-05-29 17:02             ` Richard Stallman
2004-05-29 18:19               ` Juanma Barranquero
2004-05-30 19:41                 ` Richard Stallman
2004-05-31 18:42               ` Jason Rumney
2004-06-01  4:51                 ` Eli Zaretskii
2004-06-01  7:18                   ` Juanma Barranquero
2004-06-01 20:40                     ` Eli Zaretskii
2004-06-03  0:19                       ` Juanma Barranquero
2004-06-02  3:44                   ` Richard Stallman
2004-05-27 12:28         ` Kai Grossjohann
2004-05-27 23:53           ` Luc Teirlinck
2004-05-28 14:21             ` Richard Stallman
2004-05-29  1:43               ` Luc Teirlinck
2004-05-26 17:51       ` Eli Zaretskii
2004-05-26 19:39         ` David Kastrup
2004-05-27  8:14           ` Eli Zaretskii
2004-05-26 12:57 ` Henrik Enberg
2004-05-26 16:15   ` David Kastrup
2004-05-27 23:54 ` Richard Stallman
2004-05-28  8:37   ` Kim F. Storm
2004-05-28  9:52     ` Miles Bader
2004-05-29 10:33       ` Kai Grossjohann
2004-05-29  1:44     ` Richard Stallman
2004-05-29  8:28       ` Karl Eichwalder
2004-05-30 14:30         ` Richard Stallman
2004-05-30 16:50           ` Kai Grossjohann
2004-05-31 18:39             ` Richard Stallman
2004-05-29  9:46       ` Jason Rumney
2004-05-30  3:11         ` Stefan Monnier
2004-05-30  6:08           ` Eli Zaretskii
2004-05-30 14:30         ` Richard Stallman
2004-05-28  9:07   ` Eli Zaretskii
2004-05-29  1:43     ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20040530175117.C69B.LEKTU@mi.madritel.es \
    --to=lektu@mi.madritel.es \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).