Hi, Well, it's been several years, but now I really need this fixed, so I hacked something up and am sharing the patch here.
For UBSan[1] to work, I changed the invalid casting to use memcpy(): - *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ + memcpy(_buf+align_g[_ano], &_val, sizeof(TYPE)); \ For ASan[2] to work, I just skip the signal stuff. Hopefully this (or something better?) can be merged upstream. Cheers, Sean [1] <http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> [2] <http://clang.llvm.org/docs/AddressSanitizer.html> On Sat, 8 Sep 2012 22:09:56 -0500, Elena Pourmal said: >Sean, > >Thank you for reporting! I created a ticket in our issues database >(HDFFV-8147). We will try to take a look before our next release, but >cannot promise. > >If someone on FORUM will have time to investigate and have any >questions, we will be more than happy to assist (and to accept a patch :-) > >Thank you! > >Elena >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >Elena Pourmal The HDF Group http://hdfgroup.org >1800 So. Oak St., Suite 203, Champaign IL 61820 >217.531.6112 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > >On Sep 7, 2012, at 3:32 PM, Sean McBride wrote: > >> Hi all, >> >> I have been experimenting with clang's -fcatch-undefined-behavior, >which does like its name implies. For details: >> >> <http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html> >> >> This has detected a bug in detect_C89_integers() at H5detect.c line 1285: >> >> DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; >> >> The DETECT_I macro is difficult to decipher, but I'm pretty sure it's >doing a left shift that's too big. Shifting a uint16_t by 16 or more >bits is undefined. >> >> Could someone familiar with this code investigate? >> >> It's especially annoying because this code seems to run at build time, >causing build failure: >> >> <http://cdash.hdfgroup.uiuc.edu/viewBuildError.php?buildid=5482> >> >> Which is much more annoying than just a failing unit test or two. >> >> Cheers, >> >> -- >> ____________________________________________________________ >> Sean McBride, B. Eng [email protected] >> Rogue Research www.rogue-research.com >> Mac Software Developer Montréal, Québec, Canada >> >> >> >> _______________________________________________ >> Hdf-forum is for HDF software users discussion. >> [email protected] >> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
hdf-ubsan-asan.patch
Description: Binary data
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org Twitter: https://twitter.com/hdf5
