* Unaligned access
@ 1993-02-23 15:55 Byron Jennings
0 siblings, 0 replies; 21+ messages in thread
From: Byron Jennings @ 1993-02-23 15:55 UTC (permalink / raw)
Hello
I have been trying to get ghostscript working an Alpha running OSF1. With a bit
of playing I have got it to compile and it works --- except that it generates
hundred of Unaligned access messages when running on some files. I do mean
hundreds of messages. The generation and display signifcantly slows down the
speed of display.
Two questions.
1) Has anyone got ghostscript to work without the Unaligned access messages?
2) How does one turn off the Unaligned access message? A simple redirect of
stderr and stdout does not help.
Byron Jennings
^ permalink raw reply [flat|nested] 21+ messages in thread
* unaligned access...
@ 1993-11-30 22:25 Roland Schemers
1993-11-30 23:25 ` Matt Thomas
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Roland Schemers @ 1993-11-30 22:25 UTC (permalink / raw)
How do I track down an unligned accesses? I'm getting messages
like:
Unaligned access pid=1342 <tcl> va=14001651c pc=12001e420 ra=12001e3dc type=stq
Unaligned access pid=1342 <tcl> va=140016514 pc=12001e3f0 ra=12001e3dc type=ldq
I know I can turn off those messages with "uac", but I'd rather fix them.
thanks. Roland
--
Roland J. Schemers III | Networking Systems
Systems Programmer | 414 Sweet Hall +1 (415) 723-6740
Distributed Systems Operations | Stanford, CA 94305-3090
Stanford University | schemers@Slapshot.Stanford.EDU
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access...
1993-11-30 22:25 Roland Schemers
@ 1993-11-30 23:25 ` Matt Thomas
1993-12-01 12:06 ` Burkhard Neidecker-Lutz
1993-12-07 1:27 ` Jim Hurst
2 siblings, 0 replies; 21+ messages in thread
From: Matt Thomas @ 1993-11-30 23:25 UTC (permalink / raw)
The following routine may be of use:
#include <sys/types.h>
#if (defined(__ultrix) || defined(ultrix))
#include <stddef.h>
#include <sys/syscall.h>
#include <sys/sysmips.h>
#elif defined(__osf__)
#include <sys/sysinfo.h>
#include <sys/proc.h>
#endif
void
coredump_on_unaligned_access(
void)
{
#if defined(ultrix) || defined(__ultrix)
syscall(SYS_sysmips, MIPS_FIXADE, 0, NULL, NULL, NULL);
#elif defined(__osf__)
int nvpair[2];
nvpair[0] = SSIN_UACPROC;
nvpair[1] = UAC_SIGBUS;
setsysinfo(SSI_NVPAIRS, (char *) nvpair, 1, NULL, 0);
#endif
}
--
Matt Thomas Internet: thomas@lkg.dec.com
U*X Networking UUCP: ...!decwrl!thomas
Digital Equipment Corporation Disclaimer: This message reflects my own
Littleton, MA warped views, etc.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access...
1993-11-30 22:25 Roland Schemers
1993-11-30 23:25 ` Matt Thomas
@ 1993-12-01 12:06 ` Burkhard Neidecker-Lutz
1993-12-07 1:27 ` Jim Hurst
2 siblings, 0 replies; 21+ messages in thread
From: Burkhard Neidecker-Lutz @ 1993-12-01 12:06 UTC (permalink / raw)
In article <2dgh8k$1am@nntp2.Stanford.EDU> schemers@leland.Stanford.EDU (Roland Schemers) writes:
>How do I track down an unligned accesses? I'm getting messages
>like:
>
>Unaligned access pid=1342 <tcl> va=14001651c pc=12001e420 ra=12001e3dc type=stq
>Unaligned access pid=1342 <tcl> va=140016514 pc=12001e3f0 ra=12001e3dc type=ldq
>
dbx yourprogram
(dbx) stopi at 0x12001e420
(dbx) stopi at 0x12001e3f0
(dbx) run
Asking "where" when it stops on the machine instructions at these
addresses will tell you file and source line number (though it will
print the machine instruction underneath).
Burkhard Neidecker-Lutz
Distributed Multimedia Group, CEC Karlsruhe
BERKOM II Project
Digital Equipment Corporation
neideck@nestvx.enet.dec.com
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access...
1993-11-30 22:25 Roland Schemers
1993-11-30 23:25 ` Matt Thomas
1993-12-01 12:06 ` Burkhard Neidecker-Lutz
@ 1993-12-07 1:27 ` Jim Hurst
2 siblings, 0 replies; 21+ messages in thread
From: Jim Hurst @ 1993-12-07 1:27 UTC (permalink / raw)
In article <2dgh8k$1am@nntp2.Stanford.EDU> schemers@leland.Stanford.EDU (Roland Schemers) writes:
>How do I track down an unligned accesses? I'm getting messages
>like:
>
>Unaligned access pid=1342 <tcl> va=14001651c pc=12001e420 ra=12001e3dc type=stq
>Unaligned access pid=1342 <tcl> va=140016514 pc=12001e3f0 ra=12001e3dc type=ldq
^^
It's interesting to note that the pc noted above (^^) stands for
"program counter", ie, the address where the code is generating these
exceptions.
This means you can set a breakpoint at that address in dbx, run the
code, type "where" when it stops, and find out the routine and line
number that generated the unaligned access. Unless, of course, the
executable has been stripped. Hope this helps.
-Jim
^ permalink raw reply [flat|nested] 21+ messages in thread
* unaligned access
@ 1994-02-05 21:21 Stefan Monnier
1994-02-06 9:39 ` Jarkko Hietaniemi
0 siblings, 1 reply; 21+ messages in thread
From: Stefan Monnier @ 1994-02-05 21:21 UTC (permalink / raw)
That will probably sound stupid, but I just can't get my programs to
stop when making an unaligned access. They just print a nice warning,
but that's all. No signals sent, nothing.
How can I make my programs to stop (or core dump) when making an
unaligned access ?
Stefan
--
-----------------------------------------------------
-- On the average, people seem to be acting normal --
-----------------------------------------------------
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1994-02-05 21:21 Stefan Monnier
@ 1994-02-06 9:39 ` Jarkko Hietaniemi
0 siblings, 0 replies; 21+ messages in thread
From: Jarkko Hietaniemi @ 1994-02-06 9:39 UTC (permalink / raw)
This should do the trick:
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <sys/proc.h>
#include <stdio.h>
#include <errno.h>
extern char *sys_errlist[];
extern int sys_nerr;
main()
{
int sbuf[2];
sbuf[0] = SSIN_UACPARNT;
sbuf[1] = UAC_NOFIX | UAC_SIGBUS;
errno = 0;
if (setsysinfo(SSI_NVPAIRS, (caddr_t) sbuf, 1, 0, 0) == 0)
printf("uatrap: unaligned access will now cause SIGBUS\n");
else {
fprintf(stderr, "uatrap: setsysinfo(): ");
if (errno < sys_nerr)
fprintf(stderr, sys_errlist[errno]);
else
fprintf(stderr, "errno = %d", errno);
fprintf(stderr, "\n");
}
exit(errno);
}
and to test it:
main()
{
char foo[10];
*(int *)(foo + 1) = 0xdeadbeef;
exit(42);
}
^ permalink raw reply [flat|nested] 21+ messages in thread
* unaligned access
@ 1995-05-20 4:00 Adrian Wenden
1995-05-22 4:00 ` Eric Osborne
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Adrian Wenden @ 1995-05-20 4:00 UTC (permalink / raw)
Can anyone help?
I am running OSF 3.0 on an Alpha 400 and compiling using the native 5.0 C++
compiler.
The application:
One process creates an object (A). One of A's data members is a pointer to
another object, B. Object A is then streamed to another process. The
receiving process performs some operations on Object A, obviously ignoring
the Object B pointer, and sends Object A back to the sending process.
When the application used to run on a 32-bit architecture, we cast Object
B's pointer to an unsigned long and used the network functions htonl to
convert the byte ordering before streaming, and ntohl on the receiving side
to alter the byte ordering back to the machine format. All worked fine,
until we tried to port it to a 64-bit architecture.
The problem:
What happens now is that the htonl function only reads the first 4 bytes,
and therefore corrupts Object B's 8 byte pointer value, making it useless
when Object A is returned to us. We then tried using a64l, and l64a functions
to convert the 64-bit address into a base64 string, and stream the string
instead of the unsigned representation. As far as the contents of Object
A is concerned it is reconstructed correctly when it is returned from the
the remote process, however when we attempt to use the object we get
'Unaligned Access pid=<pid no> = <exe name> va=332e31386bde pc = 120179b9c
ra = 120179b78 type = ldq.
Help:
Has anyone had either, any experience of streaming 64-bit numbers across
the network or come across an unaligned access message, and can explain to
me how I can determine what has become unaligned and how I could correct it?
Many thanks
Adrian Wenden
adrian@expersoft.com
Expersoft Corporation
San Diego, CA
(619) 546 4100 x45
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1995-05-20 4:00 Adrian Wenden
@ 1995-05-22 4:00 ` Eric Osborne
1995-05-24 4:00 ` Vepa V Sirish
1995-05-25 4:00 ` John Wood
2 siblings, 0 replies; 21+ messages in thread
From: Eric Osborne @ 1995-05-22 4:00 UTC (permalink / raw)
I ported a bunch of code, including AT&T's BaseWorX networking software and
the USL ASN.1 compiler, to Digital Alpha platforms a while back. One basic
failing that became fairly quickly evident was the fact that XDR and much
other code really assumes that a long is 32 bits - even if you do the right
thing on the Alpha machine, the receiver will likely munge the whole thing
on the other end. I did the ports under non-disclosure, so I really can't
tell you specifics of how I solved problems in that code, but here's what
I'd do if I were you.
I'd define a set of routines that send a tag (one byte is probably enough)
with your data. Have the tags relate to a set of enumerated values, and
use them as indices into a set of data decoding functions. This has many
merits. For one thing, you can avoid superfluous byte swapping. Tag the
data, and send it unencoded. Let the receiver decode if necessary. With this
technique, you will never have to waste cycles encoding data between machines
with like architectures. For instance, an Intel processor could use data
as-is from an Alpha machine, as long as the word length was appropriate. The
tag can denote anything from strings to 64 bit longs to whatever. I believe
that the DCE encoding routines use a mechanism similar to this.
XDR and many other routines which put data into "network order" actually force
big-endian byte order - the routines are biased in that fashion, and impose
senseless performance penalties on little-endian systems, especially when
communicating with another little-endian system. And, all architecture biases
aside, there are a whole lot more little-endian systems than there are any
thing else, just because of Intel.
Your alignment problem probably stems from some assumption in the code that
it can align objects on 4 byte boundaries. That doesn't work for many
data types on the Alpha machines.
Hope that helps.
Eric Osborne
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1995-05-20 4:00 Adrian Wenden
1995-05-22 4:00 ` Eric Osborne
@ 1995-05-24 4:00 ` Vepa V Sirish
1995-05-25 4:00 ` John Wood
2 siblings, 0 replies; 21+ messages in thread
From: Vepa V Sirish @ 1995-05-24 4:00 UTC (permalink / raw)
Adrian Wenden (adrian@expersoft.com) wrote:
: Can anyone help?
: I am running OSF 3.0 on an Alpha 400 and compiling using the native 5.0 C++
: compiler.
: A is concerned it is reconstructed correctly when it is returned from the
: the remote process, however when we attempt to use the object we get
: 'Unaligned Access pid=<pid no> = <exe name> va=332e31386bde pc = 120179b9c
: ra = 120179b78 type = ldq.
Hello Adrian,
I can tell u what i do when I get the unaligned access messages.
When u declare the variables in the main(), take care in declaring the
variables of the largest size first, and then declare the smaller ones
laters.
It might help to add a dummy variable like this
main()
double dummy ; /* force declarations of subsequent vars along the word
boundary */
then delclare the structures, the character buffers and then pointers
provided the structures are greater than 8 bytes and so are the character
buffers, and finally declare the integers and last the characters (they are
1 byte) .;
I have observed that when I do this,the mesg disappears. Also u will be
surprised in the manner in which the structure members are declared. Declare
the larger ones first and then the smaller ones
for example
struct XXX_fo {
long x ; /* 8 bytes */
char *str ; /* 8 bytes */
int some_no ; /*4 bytes */
char c ; /* 1 byte */
} ;
Do try rearranging the order in which the classes/structures are defineed
and I do feel there would be a drastic improvement. I work on a DEC Alpha
machine too and have observed the same problems
sirish
the message is generated because the alpha 64 accesses data structures along
64 bit word boudaries and is very particular about that .
: Help:
: Has anyone had either, any experience of streaming 64-bit numbers across
: the network or come across an unaligned access message, and can explain to
: me how I can determine what has become unaligned and how I could correct it?
: Many thanks
: Adrian Wenden
: adrian@expersoft.com
:
: Expersoft Corporation
: San Diego, CA
: (619) 546 4100 x45
--
*******************************************************************************
Vepa V Sirish ,1205 University Av.,338 ,Columbia MO 65201,Ph (R) (314)-499-0855
316 A&S Bldg, U of Missouri, Columbia MO 65211,Ph (O) (314)-882-7534
E-mail : sirish@csdeca.cs.missouri.edu, c632692@mizzou1.missouri.edu
*******************************************************************************
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1995-05-20 4:00 Adrian Wenden
1995-05-22 4:00 ` Eric Osborne
1995-05-24 4:00 ` Vepa V Sirish
@ 1995-05-25 4:00 ` John Wood
2 siblings, 0 replies; 21+ messages in thread
From: John Wood @ 1995-05-25 4:00 UTC (permalink / raw)
To: adrian
You can use "uac" to supress the display of the unaligned access messages.
But the messages are displayed to indicate that the operating system is
having to do the fixups, which will slow down the application.
I think you should be able to do something like note down the PC addresses
of the unaligned accessed, and then use the dbx debugger to stop at these
locations, and thus locate the problem in your source code.
John Wood.
^ permalink raw reply [flat|nested] 21+ messages in thread
* unaligned access
@ 1996-11-15 5:00 gautam
1996-11-16 5:00 ` Dirk Grunwald
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: gautam @ 1996-11-15 5:00 UTC (permalink / raw)
Hi,
I know this question must already have been asked. I have
searched the net, but nothing usefull. We are porting our product
to Digitals unix. We are getting unaligned accesses. We have
tried to do the following , we get the value of "pc" from the message
on the screen , eg pc = 12345678 We the start "dbx" with our exe,
$dbx prog ( where prog is the name of the exe)
inside dbx we do
0x12345678/i
this gives a name of the function, but the function is not part of
our code. We cant figure out who is calling this function.
So basically how do we figure out where the unaligned accesses
are occuring.
Also I have head there are sources existing, which when you link
with your exe, will cause a core dump to be generated at the
point where the unaligned access occurs. This would help.
Any input will be appreciated.
Thanks,
Gautam
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1996-11-15 5:00 unaligned access gautam
@ 1996-11-16 5:00 ` Dirk Grunwald
1996-11-20 5:00 ` Jeff Denham
1996-11-21 5:00 ` Anthony Berent
2 siblings, 0 replies; 21+ messages in thread
From: Dirk Grunwald @ 1996-11-16 5:00 UTC (permalink / raw)
The following is an ATOM tool that will pin-point unaligned loads and
stores to the source line.
To use this tool, you'll need to have ATOM installed. This comes on
the "complimentary products" CDROM. If you don't have a copy, you can
get it from gatekeeper.dec.com -- send me email and I'll forward you
directions. This specific ATOM tool might require the more recent
version of ATOM that supports multiple object files.
Anyhoo, once you have atom installed, unshar and go to the "extras"
subdirectory and run make. Then run make in the UnalignedLoads
directory.
This will leave you with an Inst.o and Anal.o file in the
"UnalignedLoads" directory.
Now, suppose your application is named "foo".
Build an insturmented version of foo like this:
atom foo Inst.o Anal.o -o foo-unaligned
and then run "foo-unaligned" like you normally do (ideally in the same
directory, since it needs some files generated by running "atom").
This will then report the source/line locations that are causing your
unaligned loads (all of them). As a bonus it shows you where all of
your load and store instructions are being done (by procedure and
basic block). I'm attaching a sample output. Note that this will
identify problems that occur in system libraries.
This output doesn't show what you specficially had asked for - a
procedure back trace every time you get an unaligned load or store.
For the price of a case of good beer, I'll add that code to the
instrumentation output. Heck, for more beer, I'll develop the tool and
run ATOM over your (statically link) binary and ship it back to you so
you can run it and locate the bugs. This saves you the hassle of
installing ATOM. And, if you really want it, I'll install ATOM, hack
the tool and do some phone help showing you how to run it. Can you
tell that University raises stink?
Dirk "raises, what raises?" Grunwald Assoc. Prof, Univ. of Colorado
loads -> 1938303123
stores -> 918700662
unaligned_loads -> 25277
unaligned_stores -> 25277
unaligned store rate -> 0.00
unaligned load rate -> 0.00
overall unaligned rate -> 0.00
----------
Statistics for Individual Procedures
format is: proc, loads, unaligned loads, stores, unaligned stores
for_write_seq_fmt_xmit 0.0 27.9 0.0 27.9
for__open_key 0.0 0.1 0.0 0.1
for__put_sf 0.0 1.3 0.0 1.3
for__compute_filename 0.0 0.0 0.0 0.0
cvt_integer_to_text 0.0 6.3 0.0 6.3
cvt_ieee_t_to_text 0.0 14.5 0.0 14.5
cvtas_t_to_a 0.0 28.4 0.0 28.4
__setenv 0.0 0.1 0.0 0.1
memset 0.0 7.0 0.0 7.0
sprintf 0.0 0.0 0.0 0.0
fclose 0.0 0.0 0.0 0.0
fflush 0.0 0.0 0.0 0.0
memcpy 0.0 12.5 0.0 12.5
__pty_resolv 0.0 0.0 0.0 0.0
__getcwd 0.0 1.9 0.0 1.9
_doprnt 0.0 0.0 0.0 0.0
----------
Statistics for Individual Basic Blocks
format is: proc, file, line, loads, unaligned loads, stores, unaligned stores
spedup_ lfk537e.f 5780 0.0 0.0 0.0 0.0
trace_ lfk537e.f 7289 0.0 25.1 0.0 0.0
track_ lfk537e.f 7348 0.0 25.1 0.0 0.0
for_write_seq_f for_wseq_f 803 0.0 55.3 0.0 27.9
for_write_seq_f for_wseq_f 673 0.0 1.0 0.0 0.0
for_write_seq_f for_wseq_f 1221 0.0 1.7 0.0 0.0
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: UnalignedLoads/AnalUnaligned.c
# UnalignedLoads/InstUnaligned.c UnalignedLoads/Makefile
# extra/extra.c extra/Makefile
# Wrapped by grunwald@foobar.cs.colorado.edu on Sat Nov 16 12:39:07 1996
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'UnalignedLoads/AnalUnaligned.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'UnalignedLoads/AnalUnaligned.c'\"
else
echo shar: Extracting \"'UnalignedLoads/AnalUnaligned.c'\" \(5755 characters\)
sed "s/^X//" >'UnalignedLoads/AnalUnaligned.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <stdlib.h>
X#include <assert.h>
X
Xtypedef unsigned long ul;
X
Xtypedef struct {
X ul unaligned_loads;
X ul unaligned_stores;
X ul loads;
X ul stores;
X} CacheInfo;
X
XCacheInfo *ProcInfo;
XCacheInfo *BlockInfo;
XCacheInfo ProgInfo = {0,0,0,0};
X
Xint blocknum;
X
Xint num_procs;
Xint num_blocks;
X
Xchar *program = "";
X
Xvoid
XBeforeAppRuns(char *program_name, int pn, int bn)
X{
X int i,j;
X program = program_name;
X num_procs = pn;
X num_blocks = bn;
X
X fprintf(stderr,"Allocate space for %d procs and %d blocks\n", pn, bn);
X
X ProcInfo = calloc(sizeof(CacheInfo), pn);
X assert(ProcInfo != NULL);
X
X BlockInfo = calloc(sizeof(CacheInfo), bn);
X assert(BlockInfo != NULL);
X
X blocknum = 0;
X
X}
X
Xvoid
XEnterBlock(int bn, int lds, int sts)
X{
X blocknum = bn;
X BlockInfo[bn].loads += lds;
X BlockInfo[bn].stores += sts;
X}
X
Xstatic void process_load_miss(ul tag, int index)
X{
X}
X
Xvoid
XLoad4(unsigned long addr)
X{
X if ((addr & 0x3) != 0 ) {
X BlockInfo[blocknum].unaligned_loads++;
X }
X}
X
Xvoid
XLoad8(unsigned long addr)
X{
X if ((addr & 0x7) != 0 ) {
X BlockInfo[blocknum].unaligned_loads++;
X }
X}
X
Xvoid
XStore4(unsigned long addr)
X{
X if ((addr & 0x3) != 0 ) {
X BlockInfo[blocknum].unaligned_stores++;
X }
X}
X
Xvoid
XStore8(unsigned long addr)
X{
X if ((addr & 0x7) != 0 ) {
X BlockInfo[blocknum].unaligned_stores++;
X }
X}
X
X/*
X * The output routine (very long). do_one returns TRUE if the item
X * shouldn't be printed. Also returns the loads/misses/stores/misss.
X */
X
Xint
Xdo_one(CacheInfo* ci, double *l, double *lm, double *s, double *sm)
X{
X const double min = 0.1;
X double ual = ProgInfo.unaligned_loads;
X double uas = ProgInfo.unaligned_stores;
X
X *l = (ci -> loads / (double) ProgInfo.loads) * 100;
X
X if ( ual > 0 ) {
X *lm = (ci -> unaligned_loads / ual ) * 100;
X } else {
X *lm = 0;
X }
X
X *s = (ci -> stores / (double) ProgInfo.stores) * 100;
X if ( uas > 0 ) {
X *sm = (ci -> unaligned_stores / uas ) * 100;
X } else {
X *sm = 0;
X }
X
X return ( (ci -> unaligned_loads + ci -> unaligned_stores) <= 0 );
X}
X
X
Xvoid
XAfterAppRuns()
X{
X char file_name[1024];
X FILE *fd;
X FILE *stat;
X FILE *procmap;
X double smr,lmr,mr;
X ul stores;
X ul loads;
X ul unaligned_stores;
X ul unaligned_loads;
X double avgrefs = 0;
X int on, pn, bn;
X int i;
X
X sprintf(file_name, "%s.UnaignedLoads.%d", program, (int) getpid());
X fd = fopen(file_name, "w");
X
X if ( fd == NULL ) {
X perror("fopen");
X fprintf(stderr,"Can not open ATOM output file\n");
X abort();
X } else {
X fprintf(stderr,"Writing %s\n", file_name);
X }
X
X strcpy(file_name, program);
X strcat(file_name, ".static.Unaligned");
X stat = fopen(file_name, "r");
X assert(stat != NULL);
X
X /*
X * Read procedure map
X */
X strcpy(file_name, program);
X strcat(file_name, ".static.ProcMap");
X procmap = fopen(file_name, "r");
X assert(procmap != NULL);
X fscanf(procmap, "%d %d", &pn, &bn);
X assert(pn == num_procs);
X assert(bn == num_blocks);
X for (i = 0; i < num_blocks; i++ ) {
X fscanf(procmap, "%d %d\n", &pn, &on);
X
X /*
X * Reconstruct data for total program and each procedure
X */
X ProcInfo[pn].stores += BlockInfo[i].stores;
X ProcInfo[pn].unaligned_stores += BlockInfo[i].unaligned_stores;
X ProcInfo[pn].loads += BlockInfo[i].loads;
X ProcInfo[pn].unaligned_loads += BlockInfo[i].unaligned_stores;
X
X ProgInfo.stores += BlockInfo[i].stores;
X ProgInfo.unaligned_stores += BlockInfo[i].unaligned_stores;
X ProgInfo.loads += BlockInfo[i].loads;
X ProgInfo.unaligned_loads += BlockInfo[i].unaligned_stores;
X }
X fclose(procmap);
X
X stores = ProgInfo.stores;
X loads = ProgInfo.loads;
X unaligned_stores = ProgInfo.unaligned_stores;
X unaligned_loads = ProgInfo.unaligned_loads;
X
X
X fprintf(fd,"%25s -> %10lu\n", "loads", loads);
X fprintf(fd,"%25s -> %10lu\n", "stores", stores);
X fprintf(fd,"%25s -> %10lu\n", "unaligned_loads", unaligned_loads);
X fprintf(fd,"%25s -> %10lu\n", "unaligned_stores", unaligned_stores);
X smr = (unaligned_stores / (double) stores) * 100.0;
X lmr = (unaligned_loads / (double) loads) * 100.0;
X mr = ((unaligned_loads + unaligned_stores)
X / ( (double) loads + stores)) * 100.0;
X fprintf(fd,"%25s -> %10.2f\n", "unaligned store rate", smr);
X fprintf(fd,"%25s -> %10.2f\n", "unaligned load rate", lmr);
X fprintf(fd,"%25s -> %10.2f\n", "overall unaligned rate", mr);
X
X fflush(fd);
X
X if ( stat ) {
X int i;
X /*
X * Individual procedures
X */
X fprintf(fd,"\n\n\n");
X fprintf(fd,"----------\n");
X fprintf(fd,"Statistics for Individual Procedures\n");
X fprintf(fd,"format is: proc, loads, unaligned loads, stores, unaligned stores\n");
X fprintf(fd,"\n");
X
X for (i = 0; i < num_procs; i++) {
X int l;
X double pl, plm, ps, psm;
X
X fgets(file_name, 1024, stat);
X l = strlen(file_name); file_name[l-1] = 0; /* kill newline */
X
X if ( !do_one(&ProcInfo[i], &pl, &plm, &ps, &psm) ) {
X fprintf(fd, "%-30s %6.1f %6.1f %6.1f %6.1f\n",
X file_name, pl, plm, ps, psm);
X }
X }
X /*
X * Individual basic blocks
X */
X fprintf(fd,"\n\n\n");
X fprintf(fd,"----------\n");
X fprintf(fd,"Statistics for Individual Basic Blocks\n");
X fprintf(fd,"format is: proc, file, line, loads, unaligned loads, stores, unaligned stores\n");
X fprintf(fd,"\n");
X
X for (i = 0; i < num_blocks; i++) {
X int l;
X double pl, plm, ps, psm;
X fgets(file_name, 1024, stat);
X l = strlen(file_name); file_name[l-1] = 0; /* kill newline */
X
X if ( !do_one(&BlockInfo[i], &pl, &plm, &ps, &psm) ) {
X fprintf(fd, "%-30s %6.1f %6.1f %6.1f %6.1f\n",
X file_name, pl, plm, ps, psm);
X }
X }
X fclose(stat);
X }
X fclose(fd);
X}
END_OF_FILE
if test 5755 -ne `wc -c <'UnalignedLoads/AnalUnaligned.c'`; then
echo shar: \"'UnalignedLoads/AnalUnaligned.c'\" unpacked with wrong size!
fi
# end of 'UnalignedLoads/AnalUnaligned.c'
fi
if test -f 'UnalignedLoads/InstUnaligned.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'UnalignedLoads/InstUnaligned.c'\"
else
echo shar: Extracting \"'UnalignedLoads/InstUnaligned.c'\" \(3236 characters\)
sed "s/^X//" >'UnalignedLoads/InstUnaligned.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <cmplrs/atom.inst.h>
X#include <alpha/inst.h>
X#include <string.h>
X#include <stdlib.h>
X
Xint count_instructions = 0;
X
Xunsigned
XInstrumentAll(int argc, char **argv)
X{
X Obj* obj;
X Proc* proc;
X const char *program = GetAnalName();
X char file_name[1024];
X int procnum, blocknum, objnum;
X
X AddCallProto("BeforeAppRuns(char*,int,int)");
X AddCallProto("AfterAppRuns()");
X AddCallProto("EnterBlock(int, int, int)");
X AddCallProto("Load4(VALUE)");
X AddCallProto("Store4(VALUE)");
X AddCallProto("Load8(VALUE)");
X AddCallProto("Store8(VALUE)");
X
X /*
X * Build all the objects
X */
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X if ( BuildObj(obj) ) {
X fprintf(stderr,"Unable to build %s\n", GetObjName(obj));
X return 1;
X }
X }
X
X
X /*
X * Build a table listing the files and lines for each proc and block
X */
X strcpy(file_name, program);
X strcat(file_name, ".static.Unaligned");
X output_static_information(file_name);
X
X /*
X * Output the map of basic blocks to appropriate procedures
X */
X strcpy(file_name, program);
X strcat(file_name, ".static.ProcMap");
X output_procmap(file_name);
X
X /*
X * Ok, now actually insert the instrumentation, using the same
X * proc and block numbers as before
X */
X objnum = 0;
X procnum = 0;
X blocknum = 0;
X
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X for (block =GetFirstBlock(proc); block; block = GetNextBlock(block)) {
X Inst* inst;
X int loads = 0;
X int stores = 0;
X
X for (inst =GetFirstInst(block); inst; inst = GetNextInst(inst)) {
X
X union alpha_instruction foo;
X int op;
X
X foo.word = GetInstInfo(inst, InstBinary);
X op = foo.f_format.opcode;
X
X /*
X * Skip any aligned load/store operations
X */
X if ( is_unaligned_load_store(op) ) {
X break;
X }
X
X if (IsInstType(inst,InstTypeLoad)) {
X switch ( BytesInLoadStore(inst) ) {
X case 4:
X AddCallInst(inst,InstBefore,"Load4",EffAddrValue);
X break;
X case 8:
X AddCallInst(inst,InstBefore,"Load8",EffAddrValue);
X break;
X default:
X fprintf(stderr,"Bogus size of %d returned from Bytes\n",
X BytesInLoadStore(inst) );
X abort();
X }
X
X loads++;
X
X } else if (IsInstType(inst,InstTypeStore)) {
X
X switch ( BytesInLoadStore(inst) ) {
X case 4:
X AddCallInst(inst,InstBefore,"Store4",EffAddrValue);
X break;
X case 8:
X AddCallInst(inst,InstBefore,"Store8",EffAddrValue);
X break;
X default:
X fprintf(stderr,"Bogus size of %d returned from Bytes\n",
X BytesInLoadStore(inst) );
X abort();
X }
X
X stores++;
X }
X }
X
X if ( loads + stores > 0 ) {
X AddCallBlock(block, BlockBefore, "EnterBlock",
X blocknum, loads, stores);
X }
X
X blocknum++;
X
X }
X procnum++;
X }
X objnum++;
X }
X
X AddCallProgram(ProgramBefore, "BeforeAppRuns", program,
X procnum, blocknum);
X AddCallProgram(ProgramAfter, "AfterAppRuns");
X
X /*
X * Write out all objects after full instrumentation
X */
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X WriteObj(obj);
X }
X return(0);
X}
END_OF_FILE
if test 3236 -ne `wc -c <'UnalignedLoads/InstUnaligned.c'`; then
echo shar: \"'UnalignedLoads/InstUnaligned.c'\" unpacked with wrong size!
fi
# end of 'UnalignedLoads/InstUnaligned.c'
fi
if test -f 'UnalignedLoads/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'UnalignedLoads/Makefile'\"
else
echo shar: Extracting \"'UnalignedLoads/Makefile'\" \(826 characters\)
sed "s/^X//" >'UnalignedLoads/Makefile' <<'END_OF_FILE'
XCC =cc -migrate
XCFLAGS = -O5 -I/usr/lib/newatom/Atom -I/srl/ATOM/include
XATOM = atom -A1
X
X#ATOMIZE = /srl/ATOM/ATOMized/SPEC92/espress/espress.rr
X#RUN = ./run-one /srl/ATOM/ATOMized/SPEC92/espress/test/Z5xp1.in\
X# > /dev/null
X
X#ATOMIZE = /srl/ATOM/ATOMized/SPEC92/tomcatv/tomcatv.rr
X#RUN = time ./run-one
X
X#ATOMIZE =/srl/ATOM/ATOMized/SPEC92/compres/compres.rr
X#RUN = rm -f cref.in.Z ; cp -f /srl/ATOM/ATOMized/SPEC92/compres/test/ref.in cref.in; \
X# time run-one cref.in
X
XATOMIZE =/homes/grunwald/Research/ASCI/LFK/lfk537e
XRUN = echo run it elsewhere
X
XLIBS = -L/srl/ATOM/lib -lrpcc
X
Xfoo: Anal.o Inst.o
X $(ATOM) $(ATOMIZE) Inst.o Anal.o -o run-one
X $(RUN)
X
XAnal.o: AnalUnaligned.o
X ld -non_shared -r -o $@ $^ $(LIBS)
X
XInst.o: InstUnaligned.o ../extra/extra.o
X ld -non_shared -r -o $@ $^ $(LIBS)
X
Xclean:
X -rm *.o
X -rm run-one
END_OF_FILE
if test 826 -ne `wc -c <'UnalignedLoads/Makefile'`; then
echo shar: \"'UnalignedLoads/Makefile'\" unpacked with wrong size!
fi
# end of 'UnalignedLoads/Makefile'
fi
if test -f 'extra/extra.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'extra/extra.c'\"
else
echo shar: Extracting \"'extra/extra.c'\" \(7223 characters\)
sed "s/^X//" >'extra/extra.c' <<'END_OF_FILE'
X#include "extra.h"
X#include <cmplrs/atom.inst.h>
X#include <string.h>
X#include <stdlib.h>
X#include <alpha/inst.h>
X#include <stdio.h>
X
Xint total_number_procs()
X{
X Obj* obj;
X int total_procs = 0;
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X total_procs += GetObjInfo(obj, ObjNumberProcs);
X }
X return total_procs;
X}
X
Xint total_number_blocks()
X{
X Obj* obj;
X int total_blocks = 0;
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X total_blocks += GetObjInfo(obj, ObjNumberBlocks);
X }
X return total_blocks;
X}
X
Xvoid
Xoutput_static_information(char *file_name)
X{
X FILE* f = fopen(file_name,"w");
X Proc* proc;
X Obj* obj;
X
X if ( f == NULL ) {
X fprintf(stderr,"Unable to open file %s for writing\n", file_name);
X abort();
X }
X
X fprintf(stderr,"Writing %s\n", file_name);
X
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X char woof[1024];
X char *procname = ProcName(proc);
X
X if ( procname == NULL ) {
X strcpy(woof,"Unknown procedure");
X } else {
X strcpy(woof,ProcName(proc));
X }
X woof[28] = 0;
X fprintf(f, "%-30s\n", woof);
X }
X }
X
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X for (block =GetFirstBlock(proc); block; block = GetNextBlock(block)) {
X char fn[512];
X char woof[512];
X char *procname = ProcName(proc);
X char *pfn = ProcFileName(proc);
X /*
X * Library file names tend to be long and hairy. We cut them
X * down
X */
X if ( pfn == NULL ) {
X strcpy(fn, "<unknown>");
X } else {
X char *foo;
X strcpy(fn,ProcFileName(proc));
X foo = rindex(fn, '/');
X if ( foo != NULL ) {
X strcpy(fn,foo);
X }
X }
X
X if (procname == NULL) {
X strcpy(woof, "Unkown Procedure");
X } else {
X strcpy(woof,procname);
X }
X woof[15] = 0;
X fn[10] = 0;
X
X fprintf(f, "%-15s %-10s %4d\n",
X woof, fn, InstLineNo(GetFirstInst(block)) );
X }
X }
X }
X
X fclose(f);
X}
X
Xvoid
Xoutput_procmap(char *file_name)
X{
X FILE* f = fopen(file_name,"w");
X Proc* proc;
X Obj* obj;
X
X int pn = 0;
X int bn = 0;
X int on = 0;
X
X if ( f == NULL ) {
X fprintf(stderr,"Unable to open file %s for writing\n", file_name);
X abort();
X }
X
X fprintf(stderr,"Writing %s\n", file_name);
X fprintf(f, "%d\n", total_number_procs());
X fprintf(f, "%d\n", total_number_blocks());
X
X /*
X * Output correspondence of blocks to their appropriate objects and procs
X */
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X for (block =GetFirstBlock(proc); block; block = GetNextBlock(block)) {
X fprintf(f, "%d %d\n", pn, on);
X bn++;
X }
X pn++;
X }
X on++;
X }
X fclose(f);
X}
X
X
Xint
Xis_floating_divide(int fcn)
X{
X
X switch ( fcn ) {
X case flti_divs:
X case flti_divsc:
X case flti_divsd:
X case flti_divsm:
X case flti_divssu:
X case flti_divssuc:
X case flti_divssud:
X case flti_divssui:
X case flti_divssuic:
X case flti_divssuid:
X case flti_divssuim:
X case flti_divssum:
X case flti_divsu:
X case flti_divsuc:
X case flti_divsud:
X case flti_divsum:
X case flti_divt:
X case flti_divtc:
X case flti_divtd:
X case flti_divtm:
X case flti_divtsu:
X case flti_divtsuc:
X case flti_divtsud:
X case flti_divtsui:
X case flti_divtsuic:
X case flti_divtsuid:
X case flti_divtsuim:
X case flti_divtsum:
X case flti_divtu:
X case flti_divtuc:
X case flti_divtud:
X case flti_divtum:
X case fltv_divfs:
X case fltv_divfsc:
X case fltv_divgs:
X case fltv_divgsc:
X return 1;
X default:
X return 0;
X }
X}
X
Xint
Xis_floating_multiply(int fcn)
X{
X
X switch ( fcn ) {
X case flti_muls:
X case flti_mulsc:
X case flti_mulsd:
X case flti_mulsm:
X case flti_mulssu:
X case flti_mulssuc:
X case flti_mulssud:
X case flti_mulssui:
X case flti_mulssuic:
X case flti_mulssuid:
X case flti_mulssuim:
X case flti_mulssum:
X case flti_mulsu:
X case flti_mulsuc:
X case flti_mulsud:
X case flti_mulsum:
X case flti_mult:
X case flti_multc:
X case flti_multd:
X case flti_multm:
X case flti_multsu:
X case flti_multsuc:
X case flti_multsud:
X case flti_multsui:
X case flti_multsuic:
X case flti_multsuid:
X case flti_multsuim:
X case flti_multsum:
X case flti_multu:
X case flti_multuc:
X case flti_multud:
X case flti_multum:
X case fltv_mulfs:
X case fltv_mulfsc:
X case fltv_mulgs:
X case fltv_mulgsc:
X return 1;
X default:
X return 0;
X }
X}
X
Xint
Xis_floating_sub(int fcn)
X{
X
X switch ( fcn ) {
X case flti_subs:
X case flti_subsc:
X case flti_subsd:
X case flti_subsm:
X case flti_subssu:
X case flti_subssuc:
X case flti_subssud:
X case flti_subssui:
X case flti_subssuic:
X case flti_subssuid:
X case flti_subssuim:
X case flti_subssum:
X case flti_subsu:
X case flti_subsuc:
X case flti_subsud:
X case flti_subsum:
X case flti_subt:
X case flti_subtc:
X case flti_subtd:
X case flti_subtm:
X case flti_subtsu:
X case flti_subtsuc:
X case flti_subtsud:
X case flti_subtsui:
X case flti_subtsuic:
X case flti_subtsuid:
X case flti_subtsuim:
X case flti_subtsum:
X case flti_subtu:
X case flti_subtuc:
X case flti_subtud:
X case flti_subtum:
X case fltv_subfs:
X case fltv_subfsc:
X case fltv_subgs:
X case fltv_subgsc:
X
X return 1;
X default:
X return 0;
X }
X}
X
Xint
Xis_floating_add(int fcn)
X{
X
X switch ( fcn ) {
X case flti_adds:
X case flti_addsd:
X case flti_addssu:
X case flti_addssuc:
X case flti_addssud:
X case flti_addssui:
X case flti_addssuic:
X case flti_addssuid:
X case flti_addssuim:
X case flti_addssum:
X case flti_addsu:
X case flti_addsuc:
X case flti_addsud:
X case flti_addsum:
X case flti_addt:
X case flti_addtd:
X case flti_addtsu:
X case flti_addtsuc:
X case flti_addtsud:
X case flti_addtsui:
X case flti_addtsuic:
X case flti_addtsuid:
X case flti_addtsuim:
X case flti_addtsum:
X case flti_addtu:
X case flti_addtuc:
X case flti_addtud:
X case flti_addtum:
X case fltv_addfs:
X case fltv_addfsc:
X case fltv_addgs:
X case fltv_addgsc:
X return 1;
X default:
X return 0;
X }
X}
X
Xint
XBytesInLoadStore(Inst* inst)
X{
X union alpha_instruction bits;
X int opcode;
X unsigned long PC;
X
X PC = InstPC(inst);
X bits.word = GetInstBinary(PC);
X opcode = bits.j_format.opcode;
X
X switch( opcode ) {
X case op_ldl:
X case op_ldl_l:
X
X case op_stl:
X case op_stl_c:
X return 4;
X
X /*
X * Floating point
X * F = 4 bytes
X * S = 4 bytes
X * T = 8 bytes
X * D = 8 bytes
X * G = 8 bytes
X */
X case op_ldf:
X case op_stf:
X
X case op_lds:
X case op_sts:
X
X return 4;
X
X /*
X * eight byte load/store
X */
X case op_ldq:
X case op_ldq_l:
X case op_ldq_u:
X
X case op_stq:
X case op_stq_c:
X case op_stq_u:
X return 8;
X
X case op_ldg:
X case op_stg:
X
X case op_ldt:
X case op_stt:
X
X#if not_implemented_uses_ldg_instead
X case op_ldd:
X case op_std:
X#endif
X return 8;
X
X default:
X fprintf(stderr,"Found bogus load/store instruction\n");
X fprintf(stderr,"Opcode = 0x%x\n", opcode);
X return 0;
X }
X}
X
Xint
Xis_unaligned_load_store(int fcn)
X{
X switch (fcn) {
X case op_ldq_u:
X case op_stq_u:
X return 1;
X default:
X return 0;
X }
X}
X
END_OF_FILE
if test 7223 -ne `wc -c <'extra/extra.c'`; then
echo shar: \"'extra/extra.c'\" unpacked with wrong size!
fi
# end of 'extra/extra.c'
fi
if test -f 'extra/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'extra/Makefile'\"
else
echo shar: Extracting \"'extra/Makefile'\" \(53 characters\)
sed "s/^X//" >'extra/Makefile' <<'END_OF_FILE'
Xextra.o: extra.c extra.h
X $(CC) $(CFLAGS) -c extra.c
END_OF_FILE
if test 53 -ne `wc -c <'extra/Makefile'`; then
echo shar: \"'extra/Makefile'\" unpacked with wrong size!
fi
# end of 'extra/Makefile'
fi
echo shar: End of shell archive.
exit 0
--
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1996-11-15 5:00 unaligned access gautam
1996-11-16 5:00 ` Dirk Grunwald
@ 1996-11-20 5:00 ` Jeff Denham
1996-11-22 5:00 ` Curt Smith
1996-11-21 5:00 ` Anthony Berent
2 siblings, 1 reply; 21+ messages in thread
From: Jeff Denham @ 1996-11-20 5:00 UTC (permalink / raw)
gautam wrote:
>
> So basically how do we figure out where the unaligned accesses
> are occuring.
You can also fire up ladebug bug and use the command 'catch unaligned'.
That should stop the program at the point of the unaligned fixup
fault (post-fixup, BTW) and then show you the stack trace. Hopefull
you'll be able to figure out what library the offending code belongs
to. If the stack trace doesn't show the routine name, use listobj
to see the shared library addresses and find a match with the
PC.
--
Jeff Denham, Unix Software Group, Digital Equipment Corporation
email: denham@zk3.dec.com, voice: (603) 881-0057
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1996-11-15 5:00 unaligned access gautam
1996-11-16 5:00 ` Dirk Grunwald
1996-11-20 5:00 ` Jeff Denham
@ 1996-11-21 5:00 ` Anthony Berent
2 siblings, 0 replies; 21+ messages in thread
From: Anthony Berent @ 1996-11-21 5:00 UTC (permalink / raw)
gautam wrote:
> ...
> So basically how do we figure out where the unaligned accesses
> are occuring.
> ...
>
> Gautam
One way to find unaligned accesses is to run the program under ladebug
(Digital's newer debugger). Compile the code with -g and then run it as
follows:
$ ladebug foo
(ladebug)catch unaligned
(ladebug)run
When the program hits an unaligned access it will stop; and you can then
get a stack trace (assuming the stack isn't corrupt) using the "where"
command. You can then use dbx like commands to examine code etc.
--
- Anthony
(My views are my own; I do not speak for Digital and nothing I write
should be read as Digital's position)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: unaligned access
1996-11-20 5:00 ` Jeff Denham
@ 1996-11-22 5:00 ` Curt Smith
0 siblings, 0 replies; 21+ messages in thread
From: Curt Smith @ 1996-11-22 5:00 UTC (permalink / raw)
Jeff Denham (denham@zk3.dec.com) wrote:
: gautam wrote:
: >
: > So basically how do we figure out where the unaligned accesses
: > are occuring.
Lookup uac in the man pages.
uac p sigbus
Then run your program. It will core dump at the instruction doing the
unaligned access. Use gdb or other to view the source.
We usually go straight into gdb after enabling sigbus. Then gdb
traps the signal and you're at the source line.
Curt Smith
curts@compgen.com
^ permalink raw reply [flat|nested] 21+ messages in thread
* Unaligned access
@ 1998-03-31 5:00 Allen M. Cohen
1998-04-01 5:00 ` Joe Mario
0 siblings, 1 reply; 21+ messages in thread
From: Allen M. Cohen @ 1998-03-31 5:00 UTC (permalink / raw)
We get many unaligned access errors from a AP when built under Dec Unix
4.0-D and as:
"cc -non_shared -Wf,_p8 -O -std -Olimit 3000"
When we build with as just "cc -g", there are no unaligned access
errors!
Is this a compiler bug?
Should I use uac to ignore unaligned access errors?
--
The views expressed are the author's and do not necessarily reflect the
official position of GTE or any of its subsidiaries.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Unaligned access
1998-03-31 5:00 Allen M. Cohen
@ 1998-04-01 5:00 ` Joe Mario
0 siblings, 0 replies; 21+ messages in thread
From: Joe Mario @ 1998-04-01 5:00 UTC (permalink / raw)
To: Allen M. Cohen
Allen M. Cohen wrote:
>
> We get many unaligned access errors from a AP when built under
> Dec Unix 4.0-D and as:
> "cc -non_shared -Wf,_p8 -O -std -Olimit 3000"
> When we build with as just "cc -g", there are no unaligned access
> errors! Is this a compiler bug?
It's very likely a problem in your application. If you post a small
snipit of code that shows the problem, we can help you understand
what's causing it.
When you compile with "cc -g", all optimizations are disabled.
These include optimizations that take advantage of the C language
rules that guarantee the alignment of various datatypes. That's
probably why the unaligned errors go away with "cc -g".
> Should I use uac to ignore unaligned access errors?
I wouldn't. Unaligned access errors degrade performance.
Much has been written about unaligned access errros. It's usually
a matter of taking the pc reported by the unaligned access error
and looking at the source code at or around that pc to see what's
causing it.
Below are pointers to two web pages which might be of help.
See
http://www.partner.digital.com/www-swdev/pages/Home/TECH/techsupport.html
Choose "Frequently Asked Questions" then "DIGITAL UNIX"
or
http://www.partner.digital.com/www-swdev/pages/Home/TECH/faqs/dunix/unalign.html
BTW, I see you're compiling with "-Wf,_p8" and "-Olimit 300". Neither
switch is recognized by DECC. As of UNIX V4.0, the -Olimit switch is
only recognized by -oldc. I've never seen the _p8 switch. They're not
doing any harm, nor are they doing any good.
Joe Mario
^ permalink raw reply [flat|nested] 21+ messages in thread
* Unaligned access
@ 2000-03-31 5:00 Kraisit Vittinanon
2000-04-04 4:00 ` Oisin McGuinness
0 siblings, 1 reply; 21+ messages in thread
From: Kraisit Vittinanon @ 2000-03-31 5:00 UTC (permalink / raw)
Hi,
I am wondered what is the cause of the message
Unaligned access to .....
We got this message when running an inhouse program. After we got this
message for a short time the system crash there is a message show that there
is memory fault occured.
If you have any ideas about this, please give me any advice
Thank you,
Kraisit Vittinanon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Unaligned access
2000-03-31 5:00 Unaligned access Kraisit Vittinanon
@ 2000-04-04 4:00 ` Oisin McGuinness
0 siblings, 0 replies; 21+ messages in thread
From: Oisin McGuinness @ 2000-04-04 4:00 UTC (permalink / raw)
Consult the FAQ
http://www.unix.digital.com/unix/faq/programming.html#P7
This describes unaligned access problems in general. However user mode
programs
shouldn't crash the system, so maybe your program is doing something
else too.
Kraisit Vittinanon wrote:
>
> Hi,
> I am wondered what is the cause of the message
> Unaligned access to .....
> We got this message when running an inhouse program. After we got this
> message for a short time the system crash there is a message show that there
> is memory fault occured.
> If you have any ideas about this, please give me any advice
--
Oisin McGuinness
Sumitomo Bank Capital Markets
277 Park Avenue
New York NY 10172
USA
(212)-224-4913, email: oisin@sbcm.com
^ permalink raw reply [flat|nested] 21+ messages in thread
* Unaligned access
@ 2003-03-06 6:27 Emmanuel STAPF [ISE]
0 siblings, 0 replies; 21+ messages in thread
From: Emmanuel STAPF [ISE] @ 2003-03-06 6:27 UTC (permalink / raw)
I'm getting an unaligned access error message in my program.
Unfortunately it only occurs when `-O2' is specified. I therefore had
to compile with `-O2 -g3' in order to debug it, but the location it
reports the unaligned access is in a call to memcpy and there does not
seem to be a way to access the value of locals and arguments. The line
of code looks like:
memcpy (dest, &i, sizeof(int));
where `dest' is a char *, most likely unaligned since it is an
arbitrary memory area.
where `i' is an argument passed to the function in which `memcpy' is
called.
Any hint on how to solve this,
Thanks,
Manu
uname -a reports:
OSF1 tellus.enea.se V5.1 1885 alpha
gemc_cc -V reports:
Compaq C V6.4-009 on Compaq Tru64 UNIX V5.1A (Rev. 1885)
cc -v reports:
Compaq C V6.4-214 (dtk) on Compaq Tru64 UNIX V5.1A (Rev. 1885)
Compiler Driver V6.4-014 (dtk) cc Driver
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2003-03-06 6:27 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-31 5:00 Unaligned access Kraisit Vittinanon
2000-04-04 4:00 ` Oisin McGuinness
-- strict thread matches above, loose matches on Subject: below --
2003-03-06 6:27 Emmanuel STAPF [ISE]
1998-03-31 5:00 Allen M. Cohen
1998-04-01 5:00 ` Joe Mario
1996-11-15 5:00 unaligned access gautam
1996-11-16 5:00 ` Dirk Grunwald
1996-11-20 5:00 ` Jeff Denham
1996-11-22 5:00 ` Curt Smith
1996-11-21 5:00 ` Anthony Berent
1995-05-20 4:00 Adrian Wenden
1995-05-22 4:00 ` Eric Osborne
1995-05-24 4:00 ` Vepa V Sirish
1995-05-25 4:00 ` John Wood
1994-02-05 21:21 Stefan Monnier
1994-02-06 9:39 ` Jarkko Hietaniemi
1993-11-30 22:25 Roland Schemers
1993-11-30 23:25 ` Matt Thomas
1993-12-01 12:06 ` Burkhard Neidecker-Lutz
1993-12-07 1:27 ` Jim Hurst
1993-02-23 15:55 Unaligned access Byron Jennings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox