invalid address alignment

Discussion in 'C++' started by ADS7328, May 22, 2007.

  1. ADS7328

    ADS7328 Guest

    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::eek:streambuf_iterator
    <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
    ADS7328, May 22, 2007
    #1
    1. Advertising

  2. 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::eek:streambuf_iterator
    > <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?
    Gianni Mariani, May 22, 2007
    #2
    1. Advertising

  3. ADS7328

    ADS7328 Guest

    On May 22, 2:09 pm, Gianni Mariani <> wrote:
    > 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::eek:streambuf_iterator
    > > <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
    ADS7328, May 22, 2007
    #3
  4. 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
    Victor Bazarov, May 22, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Artie Gold
    Replies:
    0
    Views:
    500
    Artie Gold
    Aug 21, 2003
  2. Ron Natalie
    Replies:
    3
    Views:
    5,796
    Artie Gold
    Aug 21, 2003
  3. Mike Wahler
    Replies:
    2
    Views:
    483
    Ron Natalie
    Aug 22, 2003
  4. Jay Hamilton
    Replies:
    1
    Views:
    421
    Victor Bazarov
    Aug 11, 2006
  5. ADS7328

    invalid address alignment

    ADS7328, May 22, 2007, in forum: C++
    Replies:
    2
    Views:
    381
    red floyd
    May 22, 2007
Loading...

Share This Page