8000 Fixed a compiler optimisation bug in tests by Sponge5 · Pull Request #101 · cryptodev-linux/cryptodev-linux · GitHub
[go: up one dir, main page]

Skip to content

Fixed a compiler optimisation bug in tests #101

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

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

Conversation

Sponge5
Copy link
@Sponge5 Sponge5 commented Jun 11, 2025

added 'volatile' to sha_speed test's must_finish global variable since it otherwise may be optimized by the compiler in the following loop in hash_data:

do {
    ...
} while(must_finish==0);

Compiler: GCC 11.3
Target: 32bit ARM cortex-a9
Optimization: -O2

@Sponge5 Sponge5 changed the title Fixed compiler optimisation bug in sha_speed Fixed a compiler optimisation bug in tests Jun 11, 2025
@Sponge5 Sponge5 force-pushed the procioa/fix-compiler-optimisation-bug branch 2 times, most recently from 522eac0 to 6f70bd5 Compare June 13, 2025 11:19
The global flag must_finish is set by an alarm handler and continuously
checked in a while loop:

    do {
        ...
    } while(must_finish==0);

Some compilers may optimize this loop if must_finish is not declared as
volatile.

Tested with:

Compiler: GCC 11.3
Target: 32bit ARM cortex-a9
Optimization: -O2
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.

1 participant
0