Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Re: Unaligned access error.
  1997-02-03  5:00 ` Allen M. Cohen
@ 1997-02-03  5:00   ` Roland Kruse
  1997-02-06  5:00     ` Mark Bartelt
  1997-02-04  5:00   ` Tim Mooney
  1 sibling, 1 reply; 7+ messages in thread
From: Roland Kruse @ 1997-02-03  5:00 UTC (permalink / raw)



Allen M. Cohen wrote:
> 
> Tim Cochran wrote:
> >
> > Hello,
> >
> > I am compiling and running a program in C++ (gcc 2.7.2) under Digital UNIX
> > 3.2c.  When I run the program I get Unaligned access errors.  The program
> > does not crash, just print out these errors.  Does anyone know what this
> > means?  (Other programs I have written don't have this problem.)
> >
> > Thanks in advance,
> > Tim
> You need to step trough the program in gdb.

That answer is, while correct, a bit discouraging if the program in
question consists of some 500,000+ source lines.

You can use the information from the error message a bit more creatively
in gdb, I'll show an example:

The message looks like this:
Unaligned access pid=29382 <name> va=143703f7 pc=12130abc ra=12130a84
type=ldl

The most interesting address is the "pc", this is the program counter
where the error occurs. You set a breakpoint at this address like this
in gdb:

(gdb) b *0x12130abc
Breakpoint 1 at 0x12130abc: file buggy_file.c, line 753.

As you see, this immediately pin-pointed a code line. You won't always
be
that lucky but you can always run the program and it will stop at the
breakpoint. 

Im my experience, unaligned access messages always indicate something
seriously
wrong with the program (typically pointer arithmetics and/or casting
problems)
and should always be taken seriously.

hope this helps,

Roland Kruse



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Unaligned access error.
@ 1997-02-03  5:00 Tim Cochran
  1997-02-03  5:00 ` Allen M. Cohen
  1997-02-04  5:00 ` Alexander Kogan
  0 siblings, 2 replies; 7+ messages in thread
From: Tim Cochran @ 1997-02-03  5:00 UTC (permalink / raw)



Hello,

I am compiling and running a program in C++ (gcc 2.7.2) under Digital UNIX
3.2c.  When I run the program I get Unaligned access errors.  The program
does not crash, just print out these errors.  Does anyone know what this
means?  (Other programs I have written don't have this problem.)

Thanks in advance,
Tim



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unaligned access error.
  1997-02-03  5:00 Unaligned access error Tim Cochran
@ 1997-02-03  5:00 ` Allen M. Cohen
  1997-02-03  5:00   ` Roland Kruse
  1997-02-04  5:00   ` Tim Mooney
  1997-02-04  5:00 ` Alexander Kogan
  1 sibling, 2 replies; 7+ messages in thread
From: Allen M. Cohen @ 1997-02-03  5:00 UTC (permalink / raw)



Tim Cochran wrote:
> 
> Hello,
> 
> I am compiling and running a program in C++ (gcc 2.7.2) under Digital UNIX
> 3.2c.  When I run the program I get Unaligned access errors.  The program
> does not crash, just print out these errors.  Does anyone know what this
> means?  (Other programs I have written don't have this problem.)
> 
> Thanks in advance,
> Tim
You need to step trough the program in gdb.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unaligned access error.
  1997-02-03  5:00 ` Allen M. Cohen
  1997-02-03  5:00   ` Roland Kruse
@ 1997-02-04  5:00   ` Tim Mooney
  1997-02-04  5:00     ` Tim Cochran
  1 sibling, 1 reply; 7+ messages in thread
From: Tim Mooney @ 1997-02-04  5:00 UTC (permalink / raw)



In article <32F61D97.3D6A@wlv.iipo.gtegsc.com>,
Allen M. Cohen <amc@wlv.iipo.gtegsc.com> wrote:
> Tim Cochran wrote:
> > 
> > Hello,
> > 
> > I am compiling and running a program in C++ (gcc 2.7.2) under Digital UNIX
> > 3.2c.  When I run the program I get Unaligned access errors.  The program
> > does not crash, just print out these errors.  Does anyone know what this
> > means?  (Other programs I have written don't have this problem.)
> > 
> > Thanks in advance,
> > Tim
> You need to step trough the program in gdb.

To expand on what Allen said  ( :-) ), `man uac' to read about unaligned
accesses.  Essentially, you're accessing data that's not aligned on the proper
byte boundaries.

As Allen indicated, the best way to find out where the problems are is to
run the program under the control of a debugger (dbx and ladebug work fine
too).  From your prompt, as yourself (not root), do:

	uac p sigbus

to cause unaligned accesses to generate a bus error.  Then run your program
under control of gdb.  Gdb will catch the bus error and show you exactly where
it happened.

BTW, this is all mentioned in the FAQ for this newsgroup.

Tim
-- 
Tim Mooney                              mooney@dogbert.cc.ndsu.NoDak.edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J1, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unaligned access error.
  1997-02-04  5:00   ` Tim Mooney
@ 1997-02-04  5:00     ` Tim Cochran
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Cochran @ 1997-02-04  5:00 UTC (permalink / raw)



Thanks for all the help.  I nailed the problem.  It was a pointer problem. 
(Porting a piece of software from a 32-bit environment to 64-bit alpha).

BTW, were is the FAQ for this newsgroup?  I haven't seen it posted here is
quite a while.

Thanks again,

Tim

Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu> wrote in article
<5d6rdp$9o4@dogbert.cc.ndsu.NoDak.edu>...
> 
> To expand on what Allen said  ( :-) ), `man uac' to read about unaligned
> accesses.  Essentially, you're accessing data that's not aligned on the
proper
> byte boundaries.
> 
> As Allen indicated, the best way to find out where the problems are is to
> run the program under the control of a debugger (dbx and ladebug work
fine
> too).  From your prompt, as yourself (not root), do:
> 
> 	uac p sigbus
> 
> to cause unaligned accesses to generate a bus error.  Then run your
program
> under control of gdb.  Gdb will catch the bus error and show you exactly
where
> it happened.
> 
> BTW, this is all mentioned in the FAQ for this newsgroup.
> 
> Tim
> -- 
> Tim Mooney                              mooney@dogbert.cc.ndsu.NoDak.edu
> Information Technology Services         (701) 231-1076 (Voice)
> Room 242-J1, IACC Building              (701) 231-8541 (Fax)
> North Dakota State University, Fargo, ND 58105-5164
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unaligned access error.
  1997-02-03  5:00 Unaligned access error Tim Cochran
  1997-02-03  5:00 ` Allen M. Cohen
@ 1997-02-04  5:00 ` Alexander Kogan
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Kogan @ 1997-02-04  5:00 UTC (permalink / raw)
  To: Tim Cochran; +Cc: kogan, sds


Tim Cochran wrote:
> 
> Hello,
> 
> I am compiling and running a program in C++ (gcc 2.7.2) under Digital UNIX
> 3.2c.  When I run the program I get Unaligned access errors.  The program
> does not crash, just print out these errors.  Does anyone know what this
> means?  (Other programs I have written don't have this problem.)
> 
> Thanks in advance,
> Tim

Check FAQ on
<URL:ftp://ftp.digital.com/pub/Digital/dec-faq/Digital-UNIX>
topic "P7. What does "unaligned access" mean, and how can I fix it?"

or you could just turn them off by saying "uac p noprint" before
running that program.

-- 
_______________________________________________________________________

Alexander B. Kogan                   Parametric Technology Corporation
E-mail: kogan@ptc.com           128 Technology Drive, Waltham MA 02154
Voice: (617) 398-5172                              Fax: (617) 398-5633



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Unaligned access error.
  1997-02-03  5:00   ` Roland Kruse
@ 1997-02-06  5:00     ` Mark Bartelt
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Bartelt @ 1997-02-06  5:00 UTC (permalink / raw)



[ Roland Kruse ]

>>  Im my experience, unaligned access messages always indicate something
>>  seriously
>>  wrong with the program (typically pointer arithmetics and/or casting
>>  problems)
>>  and should always be taken seriously.

Well, I don't think I'd go *that* far ...  Something as trivial as

	real*4 f
	real*8 d
	common /spam/ f, d

will cause an unaligned access whenever d is referenced.  One can argue
that it might be sloppy programming practice so arrange Fortran common
blocks or C structs so that things aren't on "natural" boundaries, but
I wouldn't call it "seriously wrong".  Still worth fixing, of course,
particularly in view of the performance hit that would result of there
are a lot of unaligned access traps.

Mark Bartelt                                               416/978-5619
Canadian Institute for                            mark@cita.utoronto.ca
Theoretical Astrophysics              http://www.cita.utoronto.ca/~mark

"Clothes not busy being worn are busy drying." -- Dylan, on laundry day
         [ singing "It's all right, ma (I'm only bleaching)" ]



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1997-02-06  5:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-03  5:00 Unaligned access error Tim Cochran
1997-02-03  5:00 ` Allen M. Cohen
1997-02-03  5:00   ` Roland Kruse
1997-02-06  5:00     ` Mark Bartelt
1997-02-04  5:00   ` Tim Mooney
1997-02-04  5:00     ` Tim Cochran
1997-02-04  5:00 ` Alexander Kogan

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