Bug 65730 - xtensa: ICE in libstdc++-v3/include/bits/atomic_base.h: In function ‘bool std::atomic_flag_test_and_set_explicit(std::__atomic_flag_base*, std::memory_order)’
Summary: xtensa: ICE in libstdc++-v3/include/bits/atomic_base.h: In function ‘bool std...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: ---
Assignee: jcmvbkbc
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-10 13:15 UTC by jcmvbkbc
Modified: 2015-05-20 19:14 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-04-10 00:00:00


Attachments
preprocessed source (79.49 KB, text/plain)
2015-04-10 13:15 UTC, jcmvbkbc
Details
xtensa configuration overlay (1.37 KB, text/plain)
2015-04-10 13:17 UTC, jcmvbkbc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jcmvbkbc 2015-04-10 13:15:40 UTC
Created attachment 35287 [details]
preprocessed source

With overlay that has no hardware multiplication option building libstdc++ ends with ICE:

cc1plus -std=gnu++11 compatibility-atomic-c++0x.ii

In file included from /home/jcmvbkbc/tmp/jr/Max_Fusion_MMU_KC705/build-buildroot/build/host-gcc-final-4.8.4/build/xtensa-buildroot-linux-uclibc/libstdc++-v3/include/atomic:41:0,
                 from ../../../../libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc:26:
/home/jcmvbkbc/tmp/jr/Max_Fusion_MMU_KC705/build-buildroot/build/host-gcc-final-4.8.4/build/xtensa-buildroot-linux-uclibc/libstdc++-v3/include/bits/atomic_base.h: In member function ‘bool std::atomic_flag::test_and_set(std::memory_order)’:
/home/jcmvbkbc/tmp/jr/Max_Fusion_MMU_KC705/build-buildroot/build/host-gcc-final-4.8.4/build/xtensa-buildroot-linux-uclibc/libstdc++-v3/include/bits/atomic_base.h:287:47: internal compiler error: Segmentation fault
       return __atomic_test_and_set (&_M_i, __m);
                                               ^
0xed8ae7 crash_signal
        ../../gcc/gcc/toplev.c:383
0xdba4e1 widened_mode
        ../../gcc/gcc/optabs.c:303
0xdbd699 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*, int, optab_methods)
        ../../gcc/gcc/optabs.c:1561
0xdbce5a expand_simple_binop(machine_mode, rtx_code, rtx_def*, rtx_def*, rtx_def*, int, optab_methods)
        ../../gcc/gcc/optabs.c:1313
0x1248be4 init_alignment_context
        ../../gcc/gcc/config/xtensa/xtensa.c:1470
0x1248cb4 xtensa_expand_compare_and_swap(rtx_def*, rtx_def*, rtx_def*, rtx_def*)
        ../../gcc/gcc/config/xtensa/xtensa.c:1494
0x125383e gen_sync_compare_and_swapqi(rtx_def*, rtx_def*, rtx_def*, rtx_def*)
        ../../gcc/gcc/config/xtensa/xtensa.md:1977
0xdcee66 insn_gen_fn::operator()(rtx_def*, rtx_def*, rtx_def*, rtx_def*) const
        ../../gcc/gcc/recog.h:305
0xdcddc5 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
        ../../gcc/gcc/optabs.c:8391
0xdce0c2 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        ../../gcc/gcc/optabs.c:8421
0xdcc1c1 expand_atomic_compare_and_swap(rtx_def**, rtx_def**, rtx_def*, rtx_def*, rtx_def*, bool, memmodel, memmodel)
        ../../gcc/gcc/optabs.c:7533
0xdcb856 expand_compare_and_swap_loop
        ../../gcc/gcc/optabs.c:7182
0xdcbba7 maybe_emit_compare_and_swap_exchange_loop
        ../../gcc/gcc/optabs.c:7294
0xdcbd6d expand_atomic_test_and_set(rtx_def*, rtx_def*, memmodel)
        ../../gcc/gcc/optabs.c:7406
0x98afc6 expand_builtin_atomic_test_and_set
        ../../gcc/gcc/builtins.c:5679
0x98e5a1 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        ../../gcc/gcc/builtins.c:6974
0xb0b404 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
        ../../gcc/gcc/expr.c:10488
0xb00e4a expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
        ../../gcc/gcc/expr.c:8017
0xae8ff3 expand_expr
        ../../gcc/gcc/expr.h:254
0xaf6f2f store_expr_with_bounds(tree_node*, rtx_def*, int, bool, tree_node*)
        ../../gcc/gcc/expr.c:5290

This is reproducible with current mainline and with 4.9.4.
Comment 1 jcmvbkbc 2015-04-10 13:17:30 UTC
Created attachment 35288 [details]
xtensa configuration overlay
Comment 2 jcmvbkbc 2015-05-20 18:56:46 UTC
Author: jcmvbkbc
Date: Wed May 20 18:56:14 2015
New Revision: 223452

URL: https://gcc.gnu.org/viewcvs?rev=223452&root=gcc&view=rev
Log:
Fix PR target/65730

2015-05-20  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
	* config/xtensa/xtensa.c (init_alignment_context): Replace MULT
	by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT).


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/xtensa/xtensa.c
Comment 3 jcmvbkbc 2015-05-20 19:14:10 UTC
Fixed.