7 years, 1 month ago.

Did the GCC built-in '__atomic' functions become unavailable?

Today , I got Error 20 the following in my program.

Error: Identifier "__ATOMIC_SEQ_CST" is undefined in "mruby-mbed-gvl/include/mruby/atomic_builtin_atomic.h", Line: 55, Col: 41

#if defined(__GNUC__)
#  define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#  if GCC_VERSION >= 40700
     * target process using '__atomic' functions.
     * Currently, the compile error occurs in this block.
#  elif GCC_VERSION >= 40100
     * target process using '__sync' functions.
#  else
     *  error
#  endif

It will also fail to compile '__sync' GCC built-in function. However this program and its revision had been successful to compile in July. Was there any changes with online compilation environment after this summer vacation? I think there was something changed in compile options, etc.

Is there anyone who has same problem? Please tell me if you know something.



I found the official document about GNU extension of ARMCC.


ARMCC doesn't provide '__atomic' GNU built-in function. Therefore, these functions were never used in my program.

This is my hypothesis from here,

Before summer, Online compiler had been to return _GNUC_ and _GNUC_MINOR_ and _GNUC_PATCHLEVEL_ macro values are less than 40700 and __sync_synchronize() is used in my program.

Currently, these are 40700 and '__atomic' function is used, the error occurs. Because, maybe ARMCC was version up in online environment.

I don't know why __sync_synchronize() is unavailable in online now. I export a program which is using __sync_synchronize() and it is OK to compile in my MDK ARM environment.

I can't investigate anything more than this.

I will try to think about other way to access the memory atomically.

what are you compiling with which compiler?

posted by Erik - 21 Oct 2015

Thank you for replying. I am using online IDE.

posted by sabme ua 21 Oct 2015

The online compiler however does not use the GCC compiler, so I would have expected this would never have been able to compile.

posted by Erik - 21 Oct 2015

No. I think that it can use the GNU extension, if ARMCC is given "--gnu" option. It's the same for local MDK ARM.

And furthermore, I have the binary that is compiled by online compiler in July.

I published test program which outputs the gcc version.

Import programmbed_gcc_version

for check gcc version.

It can get the "gcc version = 40700".

So, maybe '--gnu' compiler option is given in online environment. However it can not use built-in functions.

It doesn't make sense to me...

posted by sabme ua 21 Oct 2015

1 Answer

7 years, 1 month ago.

What version are u using offline ?The online compiler was updated a month ago to 5.06, which might have cased this?

Looking at ARMCC reference manual, synch_synchronize() should be available. gnu is still used, also for exported projects.

Thank you for answering.

I am using "5.05 update 2 (build 169)" on my PC.

Now, I found the occurrence condition. The error occurs if DISCO_F746NG is selected for target platform. Any other platform is no problem.

Maybe, __sync_synchronize() is not provided for M7 processors, isn't it?

I would like to enjoy DISCO_F746NG but It still have many issues...

posted by sabme ua 22 Oct 2015

That could be true.. You can email armcc support to find out about synch_synchronize for M7. Please share then an answer

posted by Martin Kojtal 22 Oct 2015

Last weekend, when I asked ARM Technical Support about sync_synchronize for M7, I got an answer that it is available for all ARMv7-M processors if '--gnu' option is applied. Unfortunately, I couldn't get an answer anymore, because I don't have arm tools license.

posted by sabme ua 02 Nov 2015