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

optimize attribute ignored by clang 11 #162

Closed
dpotop opened this issue Mar 2, 2020 · 2 comments
Closed

optimize attribute ignored by clang 11 #162

dpotop opened this issue Mar 2, 2020 · 2 comments

Comments

@dpotop
Copy link

dpotop commented Mar 2, 2020

Hello,

I'm using clang 11.0.0 (MacOSX Xcode build).
The following code:
__attribute__((optimize("-O0"))) int bench_fun() { return 0 ; }
gives the following warning:

try.c:26:16: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]

Is this a bug, or a feature? If it's a feature, how can I obtain the same effect?

Best regards,
dpotop

@tclin914
Copy link
Contributor

tclin914 commented Mar 2, 2020

It looks like that clang doesn't support this function attribute.
Do you have tried other versions of clang?
If you expect the function without any optimization, you can use __attribute__(optnone)

@dpotop
Copy link
Author

dpotop commented Mar 2, 2020

Thanks tclin914. optnone seems to work. Too bad, however, that the general attribute "optimize" does not work, for compatibility with gcc.

@dpotop dpotop closed this as completed Mar 2, 2020
am11 pushed a commit to am11/llvm-project that referenced this issue Mar 29, 2022
Do this unconditionally because there's no scenario where we would need executable stack for managed code.
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