473,513 Members | 3,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7936
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
2383
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) { return (char*) X; } inline char* deconstify2(char const * X) { return const_cast<char*>(X); } const char source = "Test"; char* alias1 =...
11
3751
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. How is this adjustment/alignment done? I goolged around alot and wans't able to find how is it done, all it said was what is byte alignment and...
9
6610
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 length is 642 bytes ( I have appended it to the end of this message). I suspect that the reason may have something to do with an incorrect declaration...
1
2851
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 structure; the map's key is also a double. The issue seemed to be occuring in the map's default comparison function so I implemented my own comparison...
2
325
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 __rwstd::digit_writer<char,std::ostreambuf_iterator
11
3359
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) static inline void *netdev_priv(struct net_device *dev) { return (char *)dev + ((sizeof(struct net_device)+ NETDEV_ALIGN_CONST)
15
4198
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
2297
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 same as its address. The second one simply depends on a term that is not well-defined. Most people consider the type to be an important part of...
1
2793
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 then encounters an exception when it calls MeasureCharacterRanges to see if the next character, i.e. the one destined to become the first character...
0
7177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5701
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5100
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.