Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* unaligned access with added confusion
@ 1997-07-02  4:00 Andrew Gentles
  0 siblings, 0 replies; only message in thread
From: Andrew Gentles @ 1997-07-02  4:00 UTC (permalink / raw)



I'm having problems with an unaligned access error, followed by a
segmentation fault. I followed the suggestions in the Digital FAQ to
track down the error, and ended up with the useful information that it
was occuring outside of my program. In fact, after some poking about it
seems that the problem is connected with libc.so.
(If I generate a call tree and machine code, the memory location at
which the
segmentation fault occurs seems to be attached to libc.so)

Running under dbx produced the following :

---------------------------------------------------------------
evol$ dbx common
dbx version 3.11.8
Type 'help' for help.

main: 582  opts = (struct nm_opts *) malloc(sizeof(struct nm_opts));
db>run

Completed 10910 noncoding sequences
Unaligned access pid=29969 <common> va=14010222c pc=3ff8104c308
ra=3ff8104d760 type=ldq
Unaligned access pid=29969 <common> va=14010222c pc=3ff8104c350
ra=3ff8104d760 type=stq
Unaligned access pid=29969 <common> va=140102234 pc=3ff8104c354
ra=3ff8104d760 type=ldq
Unaligned access pid=29969 <common> va=14010223c pc=3ff8104c358
ra=3ff8104d760 type=ldq
signal Segmentation fault at >*[(unknown), 0x3ff8104c178]       ldq
r0, 0(r16)
db>where
where
>  0 (unknown)(0x11ffff2ee, 0x3ffc0084070, 0x102, 0x3ff00000000, 0x11ffff2c8) [0x3ff8104c178]
   1 (unknown)(0x1e000, 0x1, 0x140122000, 0x3ffc00840c0, 0x0)
[0x3ff8104c360]
   2 free(0x3ff8105a48c, 0x0, 0x3ff8104d904, 0x0, 0x0) [0x3ff8104d75c]
   3 (unknown)(0x2010, 0x10, 0x3ff8000f038, 0x140140000, 0x0)
[0x3ff8104d970]
   4 malloc(0x2, 0x3ffc1000360, 0x140023eb0, 0x11ffff608, 0x140069e00)
[0x3ff8104de80]
   5 _findbuf(0x487033ba539d, 0x487033ba539d, 0xf35000002000,
0x80e900000000, 0x3ff00002000) [0x3ff81066078]
   6 __filbuf(0x3ff8105b4b4, 0x3ffc1000360, 0x2, 0x4f, 0x140023eb0)
[0x3ff81061ec4]
   7 fgets(0x140023eb0, 0x140022540, 0x3ffc1000360, 0x1, 0x11ffff608)
[0x3ff8105b4b0]
   8 seq_read_entry(pf = 0x3ffc1000360, seq_entry = 0x14000df80 = "")
["common.c":108, 0x120002144]
   9 learn(opts = 0x140002220) ["common.c":395, 0x120003058]
  10 ntuple_menu(opts = 0x140002220) ["common.c":559, 0x120003ad8]
  11 main(argc = 1, argv = 0x11ffff8c8) ["common.c":586, 0x120003b88]
db>
------------------------------------------------------------

from this it seems the culprit is a call to fgets, and is the first read
from
a newly opened file.

This all happens under DU 3.2c with the Digital C compiler, but I have
also checked on DU 3.2d and 4.0, also with gcc v 2.7.2 and get the same
results. Irritatingly,
I get no problems if I compile and run under Solaris 2.x or SunOS 4.1.3
or
HP-UX with either cc or gcc. I don't seem to be able to generate any
errors at compile time with any of the compilers. 

Does anyone have any suggestions for narrowing down the problem ?

Andrew



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-07-02  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-07-02  4:00 unaligned access with added confusion Andrew Gentles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox