Skip to content

Undefined Behaviour Errors with Phy/SelTools

Undefined behaviour sanitiser is highlighting a number of issues see e.g.

https://lhcb-nightlies.web.cern.ch/logs/tests/nightly/lhcb-sanitizers/595/x86_64-centos7-gcc9-dbg+ubsan/Moore/#failures_10

/workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:190:13: runtime error: load of misaligned address 0x0000087f1185 for type 'const int', which requires 4 byte alignment
0x0000087f1185: note: pointer points here
 75 6d 70 74 06 00 00  00 66 64 63 68 69 32 05  00 00 00 6e 6c 74 31 36  94 2c 0f 00 04 00 00 00  06
             ^ 
    #0 0x7f5e14a2ea84 in void Sel::MatrixNet::bind<Gaudi::Algorithm>(Gaudi::Algorithm*) /workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:190
/workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:147:14: runtime error: load of misaligned address 0x0000089d6ac4 for type 'const double', which requires 8 byte alignment
0x0000089d6ac4: note: pointer points here
  38 76 36 00 00 00 00 00  00 00 00 00 c5 88 27 fb  c8 ec cf 41 00 00 31 00  11 00 08 00 00 00 00 00
              ^ 
    #0 0x7f5e149674ee in Sel::detail::yabs_mx_apply(char const*, float const*) /workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:147
    #1 0x7f5e14a1a903 in Sel::MatrixNet::operator()(gsl::span<float const, -1l>) const /workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:214
/workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:149:14: runtime error: load of misaligned address 0x0000089d6acc for type 'const double', which requires 8 byte alignment
0x0000089d6acc: note: pointer points here
  00 00 00 00 c5 88 27 fb  c8 ec cf 41 00 00 31 00  11 00 08 00 00 00 00 00  50 9c e7 0b 00 00 00 00
              ^ 
    #0 0x7f5e14967513 in Sel::detail::yabs_mx_apply(char const*, float const*) /workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:149
    #1 0x7f5e14a1a903 in Sel::MatrixNet::operator()(gsl::span<float const, -1l>) const /workspace/build/Rec/InstallArea/x86_64-centos7-gcc9-dbg+ubsan/include/SelTools/MatrixNet.h:214

All look like they related to some slightly dubious looking (reinterpret) casting...

@olupton Assigning to you as you appear to be the last to make significant changes to this file, but if you can suggest anyone else who should take a look please let me know.