[Bug c/61756] New: arm-none-eabi-gcc-4.10.0 internal compiler error with atomic_flag

robertgjenssen at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jul 9 07:30:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61756

            Bug ID: 61756
           Summary: arm-none-eabi-gcc-4.10.0 internal compiler error with
                    atomic_flag
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: robertgjenssen at gmail dot com

Created attachment 33093
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33093&action=edit
sh script to build arm-none-eabi binutils, newlib and arm-none-eabi-gcc-4.10.0

1. uname -a:
Linux morgawr 3.15.3-200.fc20.x86_64 #1 SMP Tue Jul 1 16:18:00 UTC 2014 x86_64
x86_64 x86_64 GNU/Linux

2. Construct an arm-none-eabi-gcc toolchain with the attached script,
build-arm-toolchain.sh

3. Compile the following code (tt.c):

#include <stdatomic.h>

static volatile atomic_flag guard = ATOMIC_FLAG_INIT;

void try_atomic_flag_test_and_set(void)
{
  atomic_flag_test_and_set(&guard);
}

with:

arm-toolchain/bin/arm-none-eabi-gcc-4.10.0 -c -o obj/tt.o -std=c11 -O0 -g
-mcpu=arm7tdmi -Wall -Wextra -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -save-temps tt.c

and get:
$ arm-toolchain/bin/arm-none-eabi-gcc-4.10.0 -c -o obj/tt.o -std=c11 -O0 -g
-mcpu=arm7tdmi -Wall -Wextra -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -save-temps tt.c
In file included from tt.c:3:0:
tt.c: In function ‘try_atomic_flag_test_and_set’:
tt.c:9:3: internal compiler error: in emit_move_insn, at expr.c:3575
   atomic_flag_test_and_set(&guard);
   ^
0x7074a3 emit_move_insn(rtx_def*, rtx_def*)
    ../../gcc-4.10-20140706/gcc/expr.c:3574
0x8d3d74 expand_atomic_test_and_set(rtx_def*, rtx_def*, memmodel)
    ../../gcc-4.10-20140706/gcc/optabs.c:7355
0x60f094 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
    ../../gcc-4.10-20140706/gcc/builtins.c:6739
0x700b62 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
    ../../gcc-4.10-20140706/gcc/expr.c:10344
0x62d48f expand_expr
    ../../gcc-4.10-20140706/gcc/expr.h:451
0x62d48f expand_call_stmt
    ../../gcc-4.10-20140706/gcc/cfgexpand.c:2307
0x62d48f expand_gimple_stmt_1
    ../../gcc-4.10-20140706/gcc/cfgexpand.c:3202
0x62d48f expand_gimple_stmt
    ../../gcc-4.10-20140706/gcc/cfgexpand.c:3354
0x62e4bd expand_gimple_basic_block
    ../../gcc-4.10-20140706/gcc/cfgexpand.c:5192
0x62ff8d execute
    ../../gcc-4.10-20140706/gcc/cfgexpand.c:5799
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Here is tt.i:

# 1 "tt.c"
# 1 "/home/robj/TMP//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "tt.c"
# 1
"/home/robj/TMP/arm-toolchain/lib/gcc/arm-none-eabi/4.10.0/include/stdatomic.h"
1 3 4
# 29
"/home/robj/TMP/arm-toolchain/lib/gcc/arm-none-eabi/4.10.0/include/stdatomic.h"
3 4
typedef enum
  {
    memory_order_relaxed = 0,
    memory_order_consume = 1,
    memory_order_acquire = 2,
    memory_order_release = 3,
    memory_order_acq_rel = 4,
    memory_order_seq_cst = 5
  } memory_order;


typedef _Atomic _Bool atomic_bool;
typedef _Atomic char atomic_char;
typedef _Atomic signed char atomic_schar;
typedef _Atomic unsigned char atomic_uchar;
typedef _Atomic short atomic_short;
typedef _Atomic unsigned short atomic_ushort;
typedef _Atomic int atomic_int;
typedef _Atomic unsigned int atomic_uint;
typedef _Atomic long atomic_long;
typedef _Atomic unsigned long atomic_ulong;
typedef _Atomic long long atomic_llong;
typedef _Atomic unsigned long long atomic_ullong;
typedef _Atomic short unsigned int atomic_char16_t;
typedef _Atomic long unsigned int atomic_char32_t;
typedef _Atomic unsigned int atomic_wchar_t;
typedef _Atomic signed char atomic_int_least8_t;
typedef _Atomic unsigned char atomic_uint_least8_t;
typedef _Atomic short int atomic_int_least16_t;
typedef _Atomic short unsigned int atomic_uint_least16_t;
typedef _Atomic long int atomic_int_least32_t;
typedef _Atomic long unsigned int atomic_uint_least32_t;
typedef _Atomic long long int atomic_int_least64_t;
typedef _Atomic long long unsigned int atomic_uint_least64_t;
typedef _Atomic int atomic_int_fast8_t;
typedef _Atomic unsigned int atomic_uint_fast8_t;
typedef _Atomic int atomic_int_fast16_t;
typedef _Atomic unsigned int atomic_uint_fast16_t;
typedef _Atomic int atomic_int_fast32_t;
typedef _Atomic unsigned int atomic_uint_fast32_t;
typedef _Atomic long long int atomic_int_fast64_t;
typedef _Atomic long long unsigned int atomic_uint_fast64_t;
typedef _Atomic int atomic_intptr_t;
typedef _Atomic unsigned int atomic_uintptr_t;
typedef _Atomic unsigned int atomic_size_t;
typedef _Atomic int atomic_ptrdiff_t;
typedef _Atomic long long int atomic_intmax_t;
typedef _Atomic long long unsigned int atomic_uintmax_t;
# 232
"/home/robj/TMP/arm-toolchain/lib/gcc/arm-none-eabi/4.10.0/include/stdatomic.h"
3 4
typedef _Atomic struct
{

  _Bool __val;



} atomic_flag;
# 2 "tt.c" 2

static volatile atomic_flag guard = { 0 };

void try_atomic_flag_test_and_set(void)
{
  __atomic_test_and_set ((&guard), 5);
}


More information about the Gcc-bugs mailing list