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

Not working with -O3 #13

Open
iceaway opened this issue Feb 16, 2020 · 1 comment
Open

Not working with -O3 #13

iceaway opened this issue Feb 16, 2020 · 1 comment

Comments

@iceaway
Copy link

iceaway commented Feb 16, 2020

There seems to an issue when using gcc version 9.2.0 and higher optimization levels. I had to go down to -O0, otherwise the program segfaults. I tried debugging using gdb and simple "printf", and when using gdb it would trace the segfault to the line:

Complex v = {(float)(buf[ei * 2 + 0] - 128), (float)(buf[ei * 2 + 1] - 128)};

even though the index would not point outside the allocated space of buf. When using printf to debug, it appears to segfault in the return from the function run_for_frequencies. Neither makes much sense to me. Anyway, using -O0 solved the problem so that is a workaround.

@ThomasHabets
Copy link

The segfault is likely because run_for_frequencies is defined to return int, but there's no return.

Yes, failing to return an int is undefined behaviour, and can cause anything, including segfault. Change it to void, and it worked fine. At least for me.

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

2 participants