HP-UX Cadvise Diagnostics Reference Guide (5900-1865, August 2012)

Table Of Contents
Disambiguate the expression by using explicit parenthesis around the bitwise operator, thus return
( p1 == (p2 | mask) );
Reference:
4227 padding struct with %s1 bytes to align member %sq2
Cause:
The compiler has added s1 bytes before a member so that it will be aligned and hence accessed
efficiently.
Example:
typedef struct {
int field1;
double field2;
} str;
Action:
Insertion of padding bytes themselves is not a problem but you need to ensure that you do not use
hard coded offsets for accessing fields of the struct through pointers, use offset of macro instead.
In some cases the number of padding bytes being inserted can be reduced by reordering the fields.
Reference:
4228 64 bit migration: conversion from %t1 to a more strictly aligned type
%t2 may cause misaligned access
Cause:
The compiler has detected conversion of pointers from a lesser aligned type to a more strictly
aligned type. This usually happens when assigning an int pointer to a long pointer. This is not a
problem in 32 bit mode since int and long are both 4 bytes aligned but in 64 bit mode int is 4
byte aligned whereas long is 8 bytes aligned. Because of the difference in alignment in 64 bit
mode this conversion might cause unaligned access in 64 bit mode.
Example:
int a = 10;
long *lptr = (long *)&a;
Action:
For 64 bit portability ensure that your code does not assign a pointer to int to a pointer to long.
Reference:
4229 64 bit migration: conversion from %t1 to %t2 may truncate value
Cause:
The compiler has detected conversion between pointers to data types having different sizes. This
usually happens when assigning an int pointer to a long pointer or vice versa. This is not a problem
in 32 bit mode since int, long and pointer all are of same size (32 bit) but in 64 bit mode int is
32 bit whereas long and pointer are 64 bit. Because of the difference in size in 64 bit mode this
conversion might lead to incorrect behavior in 64 bit mode.
Example:
void foo(long l) {
int i = l;
}
Action:
For 64 bit portability ensure that your code does not convert from pointer and long values to int.
4227 padding struct with %s1 bytes to align member %sq2 53