Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: sysmark@helios.physics.utoronto.ca (Mark Bartelt)
Subject: How can I cause unaligned access to generate SIGBUS under DEC OSF/1?
Date: Fri, 27 Aug 1993 13:59:13 GMT	[thread overview]
Message-ID: <CCF86q.M2s@helios.physics.utoronto.ca> (raw)

Someone in our group is trying to debug a rather ugly chunk of Fortran
code on our AXPs, and is getting a number of runtime "Unaligned access"
messages.  I know how to use the "uac" command to turn the message off,
but since I suspect that the existence of the unaligned access probably
means that the code is broken, I'd like to be able to trap them.

Specifically, I expect to find errors of the following sort:

	common /spam/ x,y,z
	real*4 x,y,z
	call foo(y)
	[...]
	subroutine foo(q)
	real*8 q
	[...]

It's surprising how much of this sort of cruft one finds, partly because
on a VAX, with real*4 and real*8 having same-size exponents, code such as
this would seemingly work (since there'd be only some small error down in
the low-order bits of the mantissa).  But of course, with IEEE floating
point, one tends to get totally bogus results with this kind of error.

Anyway, looking through <sys/proc.h>, I find

struct	proc {
  [...]
	int	p_uac;	/* unaligned access control flags */
  [...]
};
  [...]
/* p_uac codes */
#define UAC_NOPRINT    0x00000001	/* Don't report unaligned fixups */
#define UAC_NOFIX      0x00000002	/* Don't fix unaligned errors */
#define UAC_SIGBUS     0x00000004	/* Notify unaligned trap by SIGBUS */

The question is, how can I set the UAC_SIGBUS bit in p_uac?  If I could,
then I can ask dbx to catch SIGBUS, and it should be relatively easy to
track down the bug(s).  I RedTFM, but didn't find anything relevant.  Is
there an undocumented system call which permits one to twiddle the bits
in the the proc struct's p_uac?  As usual, TIA.

Mark Bartelt                                                416/978-5619
Canadian Institute for                             mark@cita.toronto.edu
Theoretical Astrophysics                           mark@cita.utoronto.ca

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


             reply	other threads:[~1993-08-27 13:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-27 13:59 Mark Bartelt [this message]
1993-08-27 14:33 ` How can I cause unaligned access to generate SIGBUS under DEC OSF/1? Matt Thomas
1993-08-27 15:32 ` SUMMARY: " Mark Bartelt
read-only archive

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