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

test: Fix testcase 84 #1954

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gyuha-wa-vect0r
Copy link

@gyuha-wa-vect0r gyuha-wa-vect0r commented Sep 1, 2024

Fix testcase 84 arg_mixed in ubuntu24.04

In 84 arg_mixed test, the mixed_sub is renamed to mixed_sub.specialized.1
in clang optimized builds so the test fails.
Fix not to optimize in mixed_sub function.

Start 1 tests without worker pool

Compiler gcc clang
Runtime test case pg finstrument-fu fpatchable-fun pg finstrument-fu fpatchable-fun
------------------------: O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os
084 arg_mixed : OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK

Copy link
Collaborator

@honggyukim honggyukim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch, but your description doesn't explain what the problem is.

I would rephrase the problem statement as follows.

In 84 arg_mixed test, the mixed_sub is renamed to mixed_sub.specialized.1 in clang optimized builds so the test fails as follows.

$ ./runtest.py -vdp -O1 -c clang 084
        ...
t084_arg_mixed: diff result of clang -pg -O1 
--- expect      2024-09-01 22:24:43.922522624 +0900
+++ result      2024-09-01 22:24:43.922522624 +0900
@@ -2,3 +2,3 @@
    mixed_add(-1, 0.200000) = -0.800000;
-   mixed_sub(0x400000, 2048) = 0x3ff800;
+   mixed_sub.specialized.1();
    mixed_mul(-3.000000, 80000000000) = -240000000000;

084 arg_mixed           : NG

This can be fixed as follows.

diff --git a/tests/s-exp-mixed.c b/tests/s-exp-mixed.c
index 1e51173b..9f678937 100644
--- a/tests/s-exp-mixed.c
+++ b/tests/s-exp-mixed.c
@@ -7,6 +7,9 @@ double mixed_add(int a, float b)
        return a + b;
 }
 
+#if __clang__
+__attribute__((optnone))
+#endif
 long mixed_sub(void *a, unsigned long b)
 {
        return (long)a - b;

But I think it's not easy to pick which functions can be renamed due to clang optimization. @namhyung Do you have any better idea?

@namhyung
Copy link
Owner

namhyung commented Sep 1, 2024

I don't know if clang has an option to prevent the specialization.

Fix testcase 84 arg_mixed in ubuntu24.04

In 84 arg_mixed test, the mixed_sub is renamed to mixed_sub.specialized.1
in clang optimized builds so the test fails.
Fix not to optimize in mixed_sub function.

Signed-off-by: GYUHA LEE <[email protected]>
@gyuha-wa-vect0r
Copy link
Author

@honggyukim I fixed as you mentioned! Thank you!

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

Successfully merging this pull request may close these issues.

3 participants