-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
gcc 5.2.1/6.1.1: error: inconsistent operand constraints in an ‘asm’ #213
Comments
Urg. so the "rm" used to mean put this value in a register if possible, otherwise put it in memory. I think there's another way to say this that will avoid the conflicting constraints error. |
I cannot reproduce the error your seeing with GCC. (See https://goo.gl/krlgJM). Could you please try changing "+rm" to "+g" and tell me if that works? |
OK so I managed to reproduce here: https://goo.gl/CJqGjJ. Unfortunately the change to "+g" doesn't work. Versions of GCC prior to v5 ICE on this code. Changing "+rm" to "+g" still emits the same error. I'll file a GCC bug since "+g" shouldn't have any conflicting constraints since its obviously a single constraint. |
In hindsight I realise it is wrong to try to force a memory constraint on all non-pointer types. |
GCC Bug Filed: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71246 |
I think this has been fixed in master. Please reopen if I'm incorrect. |
Compilation fails when using benchmark::DoNotOptimize on an array:
In file included from benchmark/include/benchmark/benchmark.h:18:0, from bm_boost_crc.cpp:1: benchmark/include/benchmark/benchmark_api.h: In function ‘void {anonymous}::boost_crc6(benchmark::State&)’: benchmark/include/benchmark/benchmark_api.h:217:54: error: inconsistent operand constraints in an ‘asm’ asm volatile("" : "+rm" (const_cast<Tp&>(value)));
Although gcc documenation on asm contraints indicates they should be adjacent I find inserting a comma ("+r,m") solves this problem. However it then does not work for functions returning an integral like boost::crc_optimal's checksum method:
I find the best solution to both is to use a template for pointers separately.
I have a patch that seem to work in all cases I have encountered so far.
The text was updated successfully, but these errors were encountered: