PRUNERS / FLiT

A project to quickly detect discrepancies in floating point computation across hardware, compilers, libraries and software.
Other
36 stars 6 forks source link

Bisect broken for main subcall #273

Closed mikebentley15 closed 5 years ago

mikebentley15 commented 5 years ago

Bug Report

Describe the problem After the new feature to run other main()-like functions as a subprocess, flit bisect is broken when doing symbol bisect over the test file itself. This is because we get the error that the main function has already been registered. This happens due to both of the object files have the same static object being built, so the registration happens twice.

Suggested Fix Allow for registration to happen more than once. Just require that if it is called more than once, that it maps the same name to the same function pointer.

While we're at it, we could put the same robustness into the registration of flit tests.

Alternative approaches: Somehow fix it so that the test only gets registered once. A few potential approaches:

  1. have the user call flit::registerTest() instead of FLIT_REGISTER_TEST() and ensure it is called only once.
  2. find an alternative implementation of FLIT_REGISTER_TEST() that does not require a static variable.
  3. change symbol bisect to ensure only one of the static variables exist in the final executable.

I personally don't like any of these alternatives very much. They are feasible, but I believe they provide little to no value and are more difficult to implement.

A clear and concise description of any alternative solutions or features you've considered.