------- Comment #6 from simon dot marshall at misys dot com 2008-02-19 14:40 ------- Created an attachment (id=15184) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15184&action=view) intervals2.c and output of -v -save-temps
Maybe it was easier than I thought. I took out the function update_interval from the file internals.c, in which Emacs was detecting internal data structure inconsistency, and compiled it in a new file internals2.c. With this separate file, I can reproduce the error if I build with "-g -O1 -fno-unit-at-a-time" or "-g -O2 -fno-unit-at-a-time", but not with "-g -O0 -fno-unit-at-a-time". Attached is the output generated by "-v -save-temps -g -O1 -fno-unit-at-a-time" for this file, ie, the .c, .i, .s and the output of gcc itself. All other files in the Emacs executable were compiled with "-g -O2 -fno-unit-at-a-time". The offending call of error occurs at internals.c:34: else if (NULL_PARENT (i)) error ("Point before start of properties"); which according to internals.i is: else if (((i)->up_obj || (i)->up.interval == 0)) error ("Point before start of properties"); Note the condition that needs to be true for error to be called. However, when error is called: $ gdb emacs GNU gdb 6.7.1 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.8"... SIGINT is used by the debugger. Are you sure you want to change it? (y or n) [answered Y; input not from terminal] DISPLAY = dtp020071.misys-risk.com:0.0 TERM = xterm Breakpoint 1 at 0xe4ee4: file emacs.c, line 432. Breakpoint 2 at 0x100138: file sysdep.c, line 1384. (gdb) b intervals2.c:34 Breakpoint 3 at 0x19420c: file intervals2.c, line 34. (gdb) r -Q Starting program: /homedev/marshals/ftp/emacs-22.2-pretests/gcc-4.2.3-g-O2/src/emacs -Q warning: Temporarily disabling breakpoints for unloaded shared library "/usr/lib/ld.so.1" Breakpoint 4 at 0xc552c: file xterm.c, line 7866. Breakpoint 3, update_interval (i=0x8286f4, pos=1771) at intervals2.c:34 34 error ("Point before start of properties"); (gdb) p i->up_obj $1 = 0 (gdb) p i->up.interval $2 = (struct interval *) 0x828534 (gdb) p *i $3 = { total_length = 36, position = 1782, left = 0x828710, right = 0x828550, up = { interval = 0x828534, obj = 8553780 }, up_obj = 0, gcmarkbit = 0, write_protect = 0, visible = 0, front_sticky = 0, rear_sticky = 0, plist = 8527837 } (gdb) p i->up_obj || i->up.interval == 0 $4 = 0 (gdb) So, if the data appears to suggest that the condition should be false, why does the behaviour appear as if the condition is true? Or did I do something stupid? Is this really a symptom of some other problem? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35249