PLC-lang / rusty

Structured Text Parser and LLVM Frontend
GNU Lesser General Public License v3.0
223 stars 53 forks source link

Run LIT tests without optimization #1345

Open mhasel opened 1 month ago

mhasel commented 1 month ago

When compiling with optimization, LLVM will sometimes optimize out faulty IR we generated. The same IR can lead to segfaults when compiling without optimizations - this leaves quite a large gap in our automated test-coverage and will cause bugs to slip through.

Here's an example (which is already on master, running - and passing - with every test-run) I stumbled upon while working on initializing temporary variables: https://github.com/PLC-lang/rusty/blob/cbe548d2485d1c1df2ca02772a00ddd1c433b1c8/tests/lit/single/init/function_locals.st#L1-L27

This lit test will pass the CI without problems, however, if the same code is compiled with -Onone it leads to a segfault when executed.

We should update our runner so that all LIT tests are ran with default optimization as well as with -Onone.