Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run LIT tests without optimization #1345

Open
mhasel opened this issue Oct 22, 2024 · 0 comments
Open

Run LIT tests without optimization #1345

mhasel opened this issue Oct 22, 2024 · 0 comments

Comments

@mhasel
Copy link
Member

mhasel commented Oct 22, 2024

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:

// RUN: (%COMPILE %s && %RUN) | %CHECK %s
VAR_GLOBAL
ps: STRING := 'Hello world!';
ps2: STRING;
END_VAR
FUNCTION_BLOCK foo
VAR
s AT ps: STRING;
END_VAR
VAR_TEMP
s2 AT ps2: STRING;
END_VAR
s2 := 'Hello from me, too';
// CHECK: Hello world!
printf('%s$N', REF(s));
// CHECK: Hello from me, too
printf('%s$N', REF(s2));
END_FUNCTION_BLOCK
FUNCTION main: DINT
VAR
fb: foo;
END_VAR
fb();
END_FUNCTION

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant