473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

invalid address alignment


Dear ,

My C++ program crashes with the following error:
SIGNAL BUS (invalid addresses aligment)
at random pleaces.

t@1 (l@1) signal BUS (invalid address alignment) in
__rwstd::digit_writer<char,std::ostreambuf_iterato r
<char,std::char_traits<char >::put_digits at 0xfdf09af0
0xfdf09af0: put_digits+0x0298: ld [%o0], %l5
Current function is Analytic::Schedule (optimized)
4838 str << " " << ":R" << ":::"
<< "01/01/1900" << ":" << DF ;
(dbx) quit

Thanks in advance

bye
Tony

May 22 '07 #1
3 7931
ADS7328 wrote:
Dear ,

My C++ program crashes with the following error:
SIGNAL BUS (invalid addresses aligment)
at random pleaces.

t@1 (l@1) signal BUS (invalid address alignment) in
__rwstd::digit_writer<char,std::ostreambuf_iterato r
<char,std::char_traits<char >::put_digits at 0xfdf09af0
0xfdf09af0: put_digits+0x0298: ld [%o0], %l5
Current function is Analytic::Schedule (optimized)
4838 str << " " << ":R" << ":::"
<< "01/01/1900" << ":" << DF ;
(dbx) quit
Usually a bad cast. Are you casting to values directly from a char *
somewhere ? The compiler usually does not do this.

The resolution to this is to either use some compiler specific features
(like #pragma pack) or read a byte at a time.

The information you provide above is next to useless to us. Is it IRIX?

May 22 '07 #2
On May 22, 2:09 pm, Gianni Mariani <gi3nos...@mariani.wswrote:
ADS7328 wrote:
Dear ,
My C++ program crashes with the following error:
SIGNAL BUS (invalid addresses aligment)
at random pleaces.
t@1 (l@1) signal BUS (invalidaddressalignment) in
__rwstd::digit_writer<char,std::ostreambuf_iterato r
<char,std::char_traits<char >::put_digits at 0xfdf09af0
0xfdf09af0: put_digits+0x0298: ld [%o0], %l5
Current function is Analytic::Schedule (optimized)
4838 str << " " << ":R" << ":::"
<< "01/01/1900" << ":" << DF ;
(dbx) quit

Usually a bad cast. Are you casting to values directly from a char *
somewhere ? The compiler usually does not do this.

The resolution to this is to either use some compiler specific features
(like #pragma pack) or read a byte at a time.

The information you provide above is next to useless to us. Is it IRIX?
Thanks a lot, I'm working on Solaris 2.8

I changed into :

double DF= 0.0 ;

ostringstream str ;

str << " " << ":R" << ":::" <<
"01/01/1900" << ":" << DF ;

and I deleted the

str.~ostingstream() ;
and it seems to work fine.
But I don't undertsand if the entry " str.~ostringstream() "
was the problem.
bye
Tony




May 22 '07 #3
ADS7328 wrote:
[..]
I changed into :

double DF= 0.0 ;

ostringstream str ;

str << " " << ":R" << ":::" <<
"01/01/1900" << ":" << DF ;

and I deleted the

str.~ostingstream() ;
and it seems to work fine.
But I don't undertsand if the entry " str.~ostringstream() "
was the problem.
If you were doing

char storage[sizeof(SomeType)];
SomeType *myObject = new (storage) SomeType;

it is not guaranteed to work because the alignment requirements
for a 'char' array and 'SomeType' can be different. To perform
proper placement new, your storage has to be allocated in free
store itself or other measures have to be taken (implementation-
specific, usually) to ensure proper alignment.

Why were you calling the destructor of 'str' yourself, anyway?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 22 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Markus.Elfring | last post by:
I am interested to know if the pointer value for the memory address can be changed by a compiler if the constness of the corresponding type is cast away. inline char* deconstify1(char const * X)...
11
by: Taran | last post by:
Hi all, I was wondering how does address alignment to x byte boundary is done. For example, if I say "adjust the requested size to be on a 4-byte boundary" or for that matter 8 byte boundary....
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
1
by: Jay Hamilton | last post by:
Hello, I am running into an invalid address alignment error on an HPUX box when I attempt to lookup a value in a STL map. The argument being passed in is a double, which is accessed from a...
2
by: ADS7328 | last post by:
Dear , My C++ program crashes with the following error: SIGNAL BUS (invalid addresses aligment) at random pleaces. t@1 (l@1) signal BUS (invalid address alignment) in...
11
by: !truth | last post by:
Hi, i feel confused about the following program, and it's works to get a pointer-member's address. #define NETDEV_ALIGN 32 #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) ...
15
by: Pengjun Jia | last post by:
HP-UX 11.23, HP aC++ B3910B A.03.63 Here is a samples. bjhp1 /nfs/users/pjia>cat tt.c #include <stdlib.h> int main() { int i =10 ;
17
by: Ben Bacarisse | last post by:
candide <toto@free.frwrites: These two statements are very different. The first one is just wrong and I am pretty sure you did not mean to suggest that. There is no object in C that is the...
1
by: eBob.com | last post by:
I have some code which is trying to determine where text will wrap in a custom text box (which Inherits from Control). It determines the number of characters which will fit in the first line, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.