public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103184] New: ICE  caused by  r12-5102
@ 2021-11-11  8:47 crazylht at gmail dot com
  2021-11-11  9:09 ` [Bug target/103184] " crazylht at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2021-11-11  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103184
           Summary: ICE  caused by  r12-5102
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: aarch64-linux-gnu

Created attachment 51763
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51763&action=edit
reproduce ICE with -O2

test.i is from glibc pthread_cancel.c

> [TCWG CI] Regression caused by gcc: Improve integer bit test on __atomic_fetch_[or|and]_* returns:
> commit fb161782545224f55ba26ba663889c5e6e9a04d1
> Author: liuhongt <hongtao.liu@intel.com>
>
>     Improve integer bit test on __atomic_fetch_[or|and]_* returns
>
> Results regressed to
> # reset_artifacts:
> -10
> # true:
> 0
> # build_abe binutils:
> 1
> # build_abe stage1:
> 2
> # build_abe linux:
> 3
> # First few build errors in logs:
> # 00:00:51 pthread_cancel.c:60:1: error: type mismatch in binary expression
> # 00:00:51 pthread_cancel.c:60:1: internal compiler error: verify_gimple failed
> # 00:00:51 make[2]: *** [../o-iterator.mk:9: /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/glibc-glibc.git~master/nptl/pthread_cancel.o] Error 1
> # 00:00:52 make[1]: *** [Makefile:483: nptl/subdir_lib] Error 2
> # 00:00:52 make: *** [Makefile:9: all] Error 2

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

* [Bug target/103184] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
@ 2021-11-11  9:09 ` crazylht at gmail dot com
  2021-11-11  9:19 ` [Bug tree-optimization/103184] [12 Regression] " rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2021-11-11  9:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
Small testcase reprodce it.

#include <stdatomic.h>

int
tbit0 (_Atomic int* a)
{
#define BIT (0x01 << 3)
  return atomic_fetch_or(a, BIT) & BIT;
#undef BIT 
}

aarch64-linux-gnu-gcc test.c -O2 -S
test.c: In function ‘tbit0’:
test.c:4:1: error: type mismatch in binary expression
    4 | tbit0 (_Atomic int* a)
      | ^~~~~
int

unsigned int

int

_7 = _1 & 8;
during GIMPLE pass: fab
test.c:4:1: internal compiler error: verify_gimple failed
0xf99c2d verify_gimple_in_cfg(function*, bool)
       
/export/users2/liuhongt/gcc/intel-innersource/master/gcc/tree-cfg.c:5577
0xe618df execute_function_todo
        /export/users2/liuhongt/gcc/intel-innersource/master/gcc/passes.c:2042
0xe622cc execute_todo
        /export/users2/liuhongt/gcc/intel-innersource/master/gcc/passes.c:2096
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
  2021-11-11  9:09 ` [Bug target/103184] " crazylht at gmail dot com
@ 2021-11-11  9:19 ` rguenth at gcc dot gnu.org
  2021-11-11  9:59 ` crazylht at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-11  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |tree-optimization
           Priority|P3                          |P1
   Target Milestone|---                         |12.0
            Summary|ICE  caused by  r12-5102    |[12 Regression] ICE  caused
                   |                            |by  r12-5102

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
  2021-11-11  9:09 ` [Bug target/103184] " crazylht at gmail dot com
  2021-11-11  9:19 ` [Bug tree-optimization/103184] [12 Regression] " rguenth at gcc dot gnu.org
@ 2021-11-11  9:59 ` crazylht at gmail dot com
  2021-11-11 10:01 ` crazylht at gmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2021-11-11  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
When mask is integer_cst, it not safe to replace_uses_by (use_lhs, lhs); since
integer_cst has type signed int, but lhs has type unsigned int, and will issue
ICE for type mismatch
_7 = _1 & 8;

_1 is signed int, and 8 is unsigged int CST.


The problem is exposed only on aarch64 since the backend doesn't have
corresponding optab and failed, but the original gimple has been changed.

  switch (fn)
    {
    case IFN_ATOMIC_BIT_TEST_AND_SET:
      optab = atomic_bit_test_and_set_optab;
      break;
    case IFN_ATOMIC_BIT_TEST_AND_COMPLEMENT:
      optab = atomic_bit_test_and_complement_optab;
      break;
    case IFN_ATOMIC_BIT_TEST_AND_RESET:
      optab = atomic_bit_test_and_reset_optab;
      break;
    default:
      return;
    }

  if (optab_handler (optab, TYPE_MODE (TREE_TYPE (lhs))) == CODE_FOR_nothing)

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
                   ` (2 preceding siblings ...)
  2021-11-11  9:59 ` crazylht at gmail dot com
@ 2021-11-11 10:01 ` crazylht at gmail dot com
  2021-11-11 10:54 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2021-11-11 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #2)
> When mask is integer_cst, it not safe to replace_uses_by (use_lhs, lhs);
Similar ICE for variable mask.

int
tbit0 (_Atomic int* a, int n)
{
#define BIT (0x01 << n)
  return atomic_fetch_or(a, BIT) & BIT;
#undef BIT 
}

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
                   ` (3 preceding siblings ...)
  2021-11-11 10:01 ` crazylht at gmail dot com
@ 2021-11-11 10:54 ` pinskia at gcc dot gnu.org
  2021-11-14 21:36 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-11 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-11
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
                   ` (4 preceding siblings ...)
  2021-11-11 10:54 ` pinskia at gcc dot gnu.org
@ 2021-11-14 21:36 ` pinskia at gcc dot gnu.org
  2021-11-14 21:46 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-14 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org

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

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
                   ` (5 preceding siblings ...)
  2021-11-14 21:36 ` pinskia at gcc dot gnu.org
@ 2021-11-14 21:46 ` hjl.tools at gmail dot com
  2021-11-15 13:41 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-14 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at

https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584293.html

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
                   ` (6 preceding siblings ...)
  2021-11-14 21:46 ` hjl.tools at gmail dot com
@ 2021-11-15 13:41 ` hjl.tools at gmail dot com
  2021-11-15 20:59 ` cvs-commit at gcc dot gnu.org
  2021-11-15 21:00 ` [Bug middle-end/103184] " hjl.tools at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-15 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
The updated patch is at

https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584464.html

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

* [Bug tree-optimization/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
                   ` (7 preceding siblings ...)
  2021-11-15 13:41 ` hjl.tools at gmail dot com
@ 2021-11-15 20:59 ` cvs-commit at gcc dot gnu.org
  2021-11-15 21:00 ` [Bug middle-end/103184] " hjl.tools at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-15 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:4c19122bf5afa5cb479fd9445f0c591c52add09b

commit r12-5282-g4c19122bf5afa5cb479fd9445f0c591c52add09b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Nov 12 07:21:43 2021 -0800

    Check optab before transforming atomic bit test and operations

    Check optab before transforming equivalent, but slighly different cases
    of atomic bit test and operations to their canonical forms.

    gcc/

            PR middle-end/103184
            * tree-ssa-ccp.c (optimize_atomic_bit_test_and): Check optab
            before transforming equivalent, but slighly different cases to
            their canonical forms.

    gcc/testsuite/

            PR middle-end/103184
            * gcc.dg/pr103184-1.c: New test.
            * gcc.dg/pr103184-2.c: Likewise.

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

* [Bug middle-end/103184] [12 Regression] ICE  caused by  r12-5102
  2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
                   ` (8 preceding siblings ...)
  2021-11-15 20:59 ` cvs-commit at gcc dot gnu.org
@ 2021-11-15 21:00 ` hjl.tools at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-15 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |middle-end
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

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

end of thread, other threads:[~2021-11-15 21:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11  8:47 [Bug target/103184] New: ICE caused by r12-5102 crazylht at gmail dot com
2021-11-11  9:09 ` [Bug target/103184] " crazylht at gmail dot com
2021-11-11  9:19 ` [Bug tree-optimization/103184] [12 Regression] " rguenth at gcc dot gnu.org
2021-11-11  9:59 ` crazylht at gmail dot com
2021-11-11 10:01 ` crazylht at gmail dot com
2021-11-11 10:54 ` pinskia at gcc dot gnu.org
2021-11-14 21:36 ` pinskia at gcc dot gnu.org
2021-11-14 21:46 ` hjl.tools at gmail dot com
2021-11-15 13:41 ` hjl.tools at gmail dot com
2021-11-15 20:59 ` cvs-commit at gcc dot gnu.org
2021-11-15 21:00 ` [Bug middle-end/103184] " hjl.tools at gmail dot com

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).