[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unaligned access errors running LyX with XTL



Good afternoon

I have come up against some unaligned access errors
when running a development version of LyX. (The "rae"
branch of CVS. This branch is attempting to use xtl to pass
information around the program.) These errors occur on DEC
Alpha machines running both Digital Unix and LinuxAlpha.

Under Digital Unix, LyX was compiled with egcs-1.1.2/GNU STL
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release).
Running LyX and launching the Print dialog (which gets info
from the core of the program using xtl), the following output is sent to screen: 
Unaligned access pid=1740 <lyx> va=11fffa94a pc=120154e40 ra=120154938 type=sts

Under LinuxAlpha, LyX was compiled with gcc-2.95.2/GNU STL
gcc version 2.95.2 20000116 (Debian GNU/Linux)
Running LyX and launching the Print dialog, the following
output is sent to /var/log/kern.log:
kern.log:1:Apr  3 09:31:22 acinus kernel: lyx(29156): unaligned trap at 000002000000e954: 0000020000a9e32c 29 1

The cause of the error appears to be xtl reading data
incorrectly and is posted in xtl/objio.h. Below is some
output from gdb that may prove illuminating.

LyX uses it's own class lyxstring rather than the STL
string and its pretty certain that this is the root cause of
the problem.  The current consensus is that with lyxstring,
the beginning of the string may not be aligned on 8-byte
boundaries. Is this likely to cause xtl problems? Any ideas
what we can do about it?

TIA,
Angus

PS. I compiled LyX with the gcc option -Wcast-align and get
stacks of warnings of the form:

/usr/local/egcs/include/g++/stl_alloc.h:526: warning: cast increases required alignment of target type

No such warnings were created by compilation of FormPrint.C
(which contains the offending print dialog).

A.

`-Wcast-align' 
Warn whenever a pointer is cast such that the required alignment 
of the target is increased.  For example, warn if a `char *' is 
cast to an `int *' on machines where integers can only be accessed 
at two- or four-byte boundaries.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(gdb) r
Starting program: /usr/users/aleem/lyx/rae/src/lyx
...
NNo info about kb_action: 16
Unaligned access pid=3231 <lyx> va=11fffa92a pc=120154e40 ra=120154938 type=sts
 
Program received signal SIGBUS, Bus error.
LyXFunc::Dispatch (this=0x14008a860, action=536846912, size=1024,
      buf=0x11fffa798 "\220\037\001") at ../xtl/objio.h:313
313                                        format.output_chars(data.data(), size);
(gdb) l
308                        }
309
310                        inline obj_output& simple(const std::string& data) {
311                                        int size=data.size();
312                                        format.output_start_array(size);
313                                        format.output_chars(data.data(), size);
314                                        format.output_end_array();
315                                        return *this;
316                        }
(gdb) where
#0  LyXFunc::Dispatch (this=0x14008a860, action=536846912, size=1024,
      buf=0x11fffa798 "\220\037\001") at ../xtl/objio.h:313
#1  0x120279470 in FormPrint::update (this=0x1400ba5c0) at FormPrint.C:116
#2  0x120283934 in HideBase::show (this=0x1400ba5c0) at HideBase.C:68
#3  0x120283d88 in SigC::ObjectSlot0_<void, HideBase>::callback (
      d=0x11fffa240) at ../../../sigc++/object_slot.h:56
#4  0x12015878c in SigC::Signal0<void, SigC::Marshal<void> >::emit (
      this=0x11fffa240) at ../sigc++/basic_signal.h:193
#5  0x12013ddc8 in LyXFunc::Dispatch (this=0x1400be400, ac=7,
      do_not_use_this_arg=0x0) at ../sigc++/basic_signal.h:171
#6  0x1201707f8 in Menus::ShowFileMenu (ob=0x1400a2600) at menus.C:634
#7  0x12016dd30 in C_Menus_ShowFileMenu (ob=0x11fffa240, data=5369276512)
      at menus.C:65
#8  0x3ffbff8caac in fl_object_qread ()
#9  0x3ffbff8afc4 in fl_check_forms ()
#10 0x120121868 in LyXGUI::runTime (this=0x11fffa240) at lyx_gui.C:591
#11 0x120125758 in LyX::LyX (this=0x11ffff568, argc=0x11ffff560,
      argv=0x11ffff5c8) at ../src/lyx_main.C:130
#12 0x12016dc80 in main (argc=1, argv=0x11ffff5c8) at ../src/main.C:52
(gdb) 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++