What does “BUS_ADRALN - Invalid address alignment” error means?

前端 未结 4 2275
忘掉有多难
忘掉有多难 2021-02-15 11:02

We are on HPUX and my code is in C++. We are getting

BUS_ADRALN - Invalid address alignment

in our executable on a function call.

4条回答
  •  难免孤独
    2021-02-15 11:46

    Most processors (not x86 and friends.. the blacksheep of the family lol) require accesses to certain elements to be aligned on multiples of bytes. I.e. if you read an integer from address 0x04 that is okay, but if you try to do the same from 0x03 you will cause an interrupt to be thrown.

    This is because it's easier to implement the load/store hardware if it's always on a multiple of the data size with which you're working.

    Since HP-UX runs only on RISC processors, which typically have such constraints, you should see here -> http://en.wikipedia.org/wiki/Data_structure_alignment#RISC.

提交回复
热议问题