public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target
@ 2014-07-04  6:40 tony.wang at arm dot com
  2014-07-04  7:07 ` [Bug target/61713] " tony.wang at arm dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tony.wang at arm dot com @ 2014-07-04  6:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61713
           Summary: 4.9 ICE when building c++ code with atomic functions
                    for thumb1 target
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tony.wang at arm dot com

The tool chain is built from:
gcc version 4.9.1 20140630 (prerelease) [gcc-4_9-branch revision 212159]
when compile below code, there will be ICE.
int main()
{
  typedef bool atomic_type;
  atomic_type c1;
  atomic_type c2;
  atomic_type c3(0);
  __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
  __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
                              __ATOMIC_RELAXED);
  __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
  __atomic_load_n(&c1, __ATOMIC_RELAXED);

  return 0;
}
Remember to save it as a c++ source file. For the debuggabe gcc, the ICE is:
at1.cpp: In function 'int main()':
at1.cpp:12:47: internal compiler error: in emit_move_insn, at expr.c:3609
__atomic_test_and_set(&c1, __ATOMIC_RELAXED);
^
0x83c8240 emit_move_insn(rtx_def*, rtx_def*)
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/expr.c:3608
0x850f85d expand_atomic_test_and_set(rtx_def*, rtx_def*, memmodel)
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/optabs.c:7337
0x82ee779 expand_builtin_atomic_test_and_set
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/builtins.c:5552
0x82ee779 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/builtins.c:6781
0x83c3382 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/expr.c:10327
0x830bd38 expand_expr
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/expr.h:457
0x830bd38 expand_call_stmt
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:2275
0x830bd38 expand_gimple_stmt_1
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:3170
0x830bd38 expand_gimple_stmt
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:3322
0x830c896 expand_gimple_basic_block
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:5162
0x830ebae gimple_expand_cfg
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:5741
0x830ebae execute
/home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:5961
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.
For the release version gcc, the ICE is:
build@build-desktop:~/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/case$
../install-native/bin/arm-none-eabi-g++ -mthumb -O0 at1.cpp -S
at1.cpp: In function 'int main()':
at1.cpp:12:47: internal compiler error: in emit_move_insn, at expr.c:3609
__atomic_test_and_set(&c1, __ATOMIC_RELAXED);
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
@ 2014-07-04  7:07 ` tony.wang at arm dot com
  2014-07-04  7:47 ` zhenqiang.chen at linaro dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tony.wang at arm dot com @ 2014-07-04  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from wangzheyu <tony.wang at arm dot com> ---
This ICE also happened on the trunk.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
  2014-07-04  7:07 ` [Bug target/61713] " tony.wang at arm dot com
@ 2014-07-04  7:47 ` zhenqiang.chen at linaro dot org
  2014-07-10  8:09 ` ktkachov at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: zhenqiang.chen at linaro dot org @ 2014-07-04  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from zhenqiang.chen at linaro dot org ---
Root cause:

When expand_call_stmt, if gimple_call_lhs (stmt) is NULL, it will set target to
const0_rtx.

Then when expand_atomic_test_and_set, it tries to emit_move_insn (subtarget,
mem). Moving a value to const0_rtx is defintely illegal.

>From the context, we can see const0_rtx means no return value. In this case, no
need to emit_move_insn (subtarget, mem). I will work out a patch to check
subtarget.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
  2014-07-04  7:07 ` [Bug target/61713] " tony.wang at arm dot com
  2014-07-04  7:47 ` zhenqiang.chen at linaro dot org
@ 2014-07-10  8:09 ` ktkachov at gcc dot gnu.org
  2014-07-10  8:11 ` ktkachov at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2014-07-10  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |robertgjenssen at gmail dot com

--- Comment #3 from ktkachov at gcc dot gnu.org ---
*** Bug 61756 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
                   ` (2 preceding siblings ...)
  2014-07-10  8:09 ` ktkachov at gcc dot gnu.org
@ 2014-07-10  8:11 ` ktkachov at gcc dot gnu.org
  2014-08-04 10:04 ` ktkachov at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2014-07-10  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Target|                            |arm-none-eabi
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-07-10
                 CC|                            |ktkachov at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |4.10.0, 4.9.0

--- Comment #4 from ktkachov at gcc dot gnu.org ---
I'll take it.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
                   ` (3 preceding siblings ...)
  2014-07-10  8:11 ` ktkachov at gcc dot gnu.org
@ 2014-08-04 10:04 ` ktkachov at gcc dot gnu.org
  2014-08-10 23:03 ` yroux at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2014-08-04 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from ktkachov at gcc dot gnu.org ---
Author: ktkachov
Date: Mon Aug  4 10:03:32 2014
New Revision: 213555

URL: https://gcc.gnu.org/viewcvs?rev=213555&root=gcc&view=rev
Log:
PR 61713: ICE when expanding single-threaded version of atomic_test_and_set.

    PR target/61713
    * gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit
    move to subtarget in serial version if result is ignored.

    PR target/61713
    * gcc.dg/pr61756.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr61756.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/optabs.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
                   ` (4 preceding siblings ...)
  2014-08-04 10:04 ` ktkachov at gcc dot gnu.org
@ 2014-08-10 23:03 ` yroux at gcc dot gnu.org
  2014-08-14  9:32 ` ktkachov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: yroux at gcc dot gnu.org @ 2014-08-10 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from yroux at gcc dot gnu.org ---
Author: yroux
Date: Sun Aug 10 23:03:16 2014
New Revision: 213801

URL: https://gcc.gnu.org/viewcvs?rev=213801&root=gcc&view=rev
Log:
gcc/
2014-08-11 Yvan Roux  <yvan.roux@linaro.org>

    Backport from trunk r213555.
    2014-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    PR target/61713
    * gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit
    move to subtarget in serial version if result is ignored.

gcc/testsuite
2014-08-11 Yvan Roux  <yvan.roux@linaro.org>
    Backport from trunk r213555.
    2014-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    PR target/61713
    * gcc.dg/pr61756.c: New test.


Added:
    branches/linaro/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr61756.c
Modified:
    branches/linaro/gcc-4_9-branch/gcc/ChangeLog.linaro
    branches/linaro/gcc-4_9-branch/gcc/optabs.c
    branches/linaro/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
                   ` (5 preceding siblings ...)
  2014-08-10 23:03 ` yroux at gcc dot gnu.org
@ 2014-08-14  9:32 ` ktkachov at gcc dot gnu.org
  2014-10-16 16:18 ` ktkachov at gcc dot gnu.org
  2021-11-29  7:32 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2014-08-14  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from ktkachov at gcc dot gnu.org ---
Author: ktkachov
Date: Thu Aug 14 09:32:17 2014
New Revision: 213954

URL: https://gcc.gnu.org/viewcvs?rev=213954&root=gcc&view=rev
Log:
[optabs.c] Fix ICE when expanding single-threaded version of
atomic_test_and_set

    Backport from mainline
    2014-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    PR target/61713
    * gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit
    move to subtarget in serial version if result is ignored.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr61756.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/optabs.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
                   ` (6 preceding siblings ...)
  2014-08-14  9:32 ` ktkachov at gcc dot gnu.org
@ 2014-10-16 16:18 ` ktkachov at gcc dot gnu.org
  2021-11-29  7:32 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2014-10-16 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0
      Known to fail|4.10.0                      |5.0

--- Comment #8 from ktkachov at gcc dot gnu.org ---
This has been fixed on trunk and 4.9


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/61713] ICE when building c++ code with atomic functions for thumb1 target
  2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
                   ` (7 preceding siblings ...)
  2014-10-16 16:18 ` ktkachov at gcc dot gnu.org
@ 2021-11-29  7:32 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-29  7:32 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mans at mansr dot com

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 56964 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-11-29  7:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04  6:40 [Bug target/61713] New: 4.9 ICE when building c++ code with atomic functions for thumb1 target tony.wang at arm dot com
2014-07-04  7:07 ` [Bug target/61713] " tony.wang at arm dot com
2014-07-04  7:47 ` zhenqiang.chen at linaro dot org
2014-07-10  8:09 ` ktkachov at gcc dot gnu.org
2014-07-10  8:11 ` ktkachov at gcc dot gnu.org
2014-08-04 10:04 ` ktkachov at gcc dot gnu.org
2014-08-10 23:03 ` yroux at gcc dot gnu.org
2014-08-14  9:32 ` ktkachov at gcc dot gnu.org
2014-10-16 16:18 ` ktkachov at gcc dot gnu.org
2021-11-29  7:32 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).