UndefinedBehavior alignment
in hipo::structure
Running Clang's UndefinedBehaviorSanitizer
in iguana
, which depends on this repo, reveals the following alignment
issue in hipo::bank::getFloatAt
:
/__w/iguana/iguana/hipo/lib/pkgconfig/../../include/hipo4/bank.h:116:16: runtime error: load of misaligned address 0x55e52f404da6 for type 'float', which requires 4 byte alignment
0x55e52f404da6: note: pointer points here
00 00 00 00 00 00 80 bf 00 00 80 bf 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
#0 0x7fb0b4ad3ee4 in hipo::structure::getFloatAt(int) const /__w/iguana/iguana/hipo/lib/pkgconfig/../../include/hipo4/bank.h:116:16
#1 0x7fb0b4ad1d73 in hipo::bank::getFloat(char const*, int) const /__w/iguana/iguana/hipo/lib/pkgconfig/../../include/hipo4/bank.h:449:16
#2 0x7fb0b4ae3d26 in iguana::clas12::MomentumCorrection::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const /__w/iguana/iguana/build-iguana/../src/iguana/algorithms/clas12/MomentumCorrection.cc:20:29
#3 0x7fb0b4a9f6f3 in iguana::AlgorithmSequence::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const /__w/iguana/iguana/build-iguana/../src/iguana/algorithms/AlgorithmSequence.cc:11:46
#4 0x55e52d1cab07 in main /__w/iguana/iguana/build-iguana/../src/iguana/tests/iguana-test.cc:103:11
#5 0x7fb0b42dcccf (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
#6 0x7fb0b42dcd89 in __libc_start_main (/usr/lib/libc.so.6+0x25d89) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
#7 0x55e52d193dd4 in _start (/__w/iguana/iguana/build-iguana/src/iguana/tests/iguana-test+0x7add4) (BuildId: 1a4186039a18b5d38dec21484f462abf569d1f4c)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /__w/iguana/iguana/hipo/lib/pkgconfig/../../include/hipo4/bank.h:116:16 in
For now I've suppressed it in iguana
's sanitizer, but documenting the issue here.
See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html