Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

C++11 support issue - memory_order_release is undefined

psing51
New Contributor I
842 Views

Dear Sir,
I am trying to compile a code , and i am getting an error:-
icc -c -O2 -lpthread -xHOST -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112 -std=c11 -fno-strict-aliasing load.c
 

load.c(277): warning #266: function "atomic_thread_fence" declared implicitly

                      { atomic_thread_fence(memory_order_release);};

                        ^

load.c(277): error: identifier "memory_order_release" is undefined
                      { atomic_thread_fence(memory_order_release);};
                                            ^

compilation aborted for load.c (code 2)

Is the following version of intel missing c++11 support (http://en.cppreference.com/w/cpp/atomic/memory_order) or am i using wrong flags?
$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.3.187 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.



File is attached herewith.
Eagerly awaiting your reply.

0 Kudos
3 Replies
Judith_W_Intel
Employee
842 Views

 

The attached file cannot be compiled because of a missing header file

sptel15-71> icc -c -O2 -lpthread -xHOST -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112 -std=c11 -fno-strict-aliasing load.c
load.c(38): catastrophic error: cannot open source file "stdinc.h"
  #include "stdinc.h"
                     ^

compilation aborted for load.c (code 4)
sptel15-72>

 

 

0 Kudos
psing51
New Contributor I
842 Views

Here is the application which i am trying to compile: https://github.com/SakalisC/Splash-3/archive/v3.0.tar.gz

I tried compiled the file with various compilers , here are my observations:

[puneet@login02 barnes]$ module purge
[puneet@login02 barnes]$ gcc -c -O2 -lpthread  -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112 -std=c11 -fno-strict-aliasing load.c
cc1: error: unrecognized command line option "-std=c11"
[puneet@login02 barnes]$ module load gcc/4.9.3/compilervars 
[puneet@login02 barnes]$ gcc -c -O2 -lpthread  -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112 -std=c11 -fno-strict-aliasing load.c
[puneet@login02 barnes]$ module purge
[puneet@login02 barnes]$ module load intel/parallelStudio 
[puneet@login02 barnes]$ icc -c -O2 -lpthread  -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112 -std=c11 -fno-strict-aliasing load.c
load.c(277): warning #266: function "atomic_thread_fence" declared implicitly
  					{ atomic_thread_fence(memory_order_release);};
  					  ^

load.c(277): error: identifier "memory_order_release" is undefined
  					{ atomic_thread_fence(memory_order_release);};
  					                      ^

compilation aborted for load.c (code 2)


It seems that this version of icc does not support C11. Please confirm if my observations are true so that we could purchase licenses for a newer version of intel suite(which supports the same). 

0 Kudos
Melanie_B_Intel
Employee
842 Views

Intel support for c11 atomic including the builtin atomic_thread_fence is expected to be available in the 18.0 Linux compiler which will be released later this year.Intel support for c11 atomic including the builtin atomic_thread_fence is expected to be available in the 18.0 Linux compiler which will be released later this year.

As a workaround you could try one of the Intel memory fence intrinsics, here is a forum thread which discusses them. https://software.intel.com/en-us/forums/intel-c-compiler/topic/393396

0 Kudos
Reply