Skip to content

unaligned accesses on RISC processors #26

@gco

Description

@gco

This sort of code is not portable and tends to not work on RISC processors:

  case BSER_INT16:
      *val = *(int16_t*)(buf+1);
      return 1;
    case BSER_INT32:
      *val = *(int32_t*)(buf+1);
      return 1;
    case BSER_INT64:
      *val = *(int64_t*)(buf+1);
      return 1;

It fails with bus errors on SPARC, for example, when the alignment isn't correct.

  • bser_real(), bunser() - dereferences double pointer of unknown alignment
  • bser_int(), bunser_int() - dereferences 16-bit, 32-bit, and 64-bit integer pointers of unknown alignment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions