public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101858] New: [12 Regression] ICE: ‘verify_gimple’ failed
@ 2021-08-11  7:42 anbu1024.me at gmail dot com
  2021-08-11  8:07 ` [Bug c/101858] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: anbu1024.me at gmail dot com @ 2021-08-11  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101858
           Summary: [12 Regression] ICE: ‘verify_gimple’ failed
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anbu1024.me at gmail dot com
  Target Milestone: ---

$ cat test.c 

int foo(a)
{
    if ( a < (int*)(1LL << a))
        a = 0;

    return a;
}

----------------------------------------------------------------

$ gcc-sp12 --version
gcc (GCC) 12.0.0 20210729 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

----------------------------------------------------------------

$ gcc-sp12 test.c 
test.c: In function ‘foo’:
test.c:2:5: warning: type of ‘a’ defaults to ‘int’ [-Wimplicit-int]
    2 | int foo(a)
      |     ^~~
test.c:4:12: warning: comparison between pointer and integer
    4 |     if ( a < (int*)(1LL << a))
      |            ^
test.c:2:5: error: type mismatch in ‘rshift_expr’
    2 | int foo(a)
      |     ^~~
int *
int *
int
_3 = _2 >> a;
test.c:2:5: internal compiler error: ‘verify_gimple’ failed
0xecbccd verify_gimple_in_seq(gimple*)
        ../../gcc-12-20210801/gcc/tree-cfg.c:5183
0xbe644a gimplify_body(tree_node*, bool)
        ../../gcc-12-20210801/gcc/gimplify.c:15539
0xbe657d gimplify_function_tree(tree_node*)
        ../../gcc-12-20210801/gcc/gimplify.c:15610
0xa1ed77 cgraph_node::analyze()
        ../../gcc-12-20210801/gcc/cgraphunit.c:670
0xa218f7 analyze_functions
        ../../gcc-12-20210801/gcc/cgraphunit.c:1234
0xa225bd symbol_table::finalize_compilation_unit()
        ../../gcc-12-20210801/gcc/cgraphunit.c:2508
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.

----------------------------------------------------------------

$ gcc-sp11 --version
gcc (GCC) 11.1.1 20210717
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

----------------------------------------------------------------

$ gcc-sp11 test.c 
test.c: In function ‘foo’:
test.c:2:5: warning: type of ‘a’ defaults to ‘int’ [-Wimplicit-int]
    2 | int foo(a)
      |     ^~~
test.c:4:12: warning: comparison between pointer and integer
    4 |     if ( a < (int*)(1LL << a))
      |            ^
/usr/bin/ld: /lib/x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status

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

* [Bug c/101858] [12 Regression] ICE: ‘verify_gimple’ failed
  2021-08-11  7:42 [Bug c/101858] New: [12 Regression] ICE: ‘verify_gimple’ failed anbu1024.me at gmail dot com
@ 2021-08-11  8:07 ` marxin at gcc dot gnu.org
  2021-08-11  8:15 ` [Bug middle-end/101858] " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-11  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, it's very old (at least 4.9.0+).

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

* [Bug middle-end/101858] [12 Regression] ICE: ‘verify_gimple’ failed
  2021-08-11  7:42 [Bug c/101858] New: [12 Regression] ICE: ‘verify_gimple’ failed anbu1024.me at gmail dot com
  2021-08-11  8:07 ` [Bug c/101858] " marxin at gcc dot gnu.org
@ 2021-08-11  8:15 ` rguenth at gcc dot gnu.org
  2021-08-11 12:01 ` cvs-commit at gcc dot gnu.org
  2021-08-11 12:01 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-11  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
          Component|c                           |middle-end
             Status|NEW                         |ASSIGNED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
#0  build2 (code=RSHIFT_EXPR, tt=<pointer_type 0x7ffff65649d8>, 
    arg0=<convert_expr 0x7ffff6686260>, arg1=<parm_decl 0x7ffff669d000 a>)
    at /home/rguenther/src/gcc2/gcc/tree.c:4970
#1  0x0000000000eb1bab in fold_binary_loc (loc=2147483651, code=LT_EXPR, 
    type=<integer_type 0x7ffff655c5e8 int>, op0=<convert_expr 0x7ffff6686260>, 
    op1=<convert_expr 0x7ffff6686220>)
    at /home/rguenther/src/gcc2/gcc/fold-const.c:12510

      /* Similarly for X < (cast) (1 << Y).  But cast can't be narrowing,
         otherwise Y might be >= # of bits in X's type and thus e.g.
         (unsigned char) (1 << Y) for Y 15 might be 0.
         If the cast is widening, then 1 << Y should have unsigned type,
         otherwise if Y is number of bits in the signed shift type minus 1,
         we can't optimize this.  E.g. (unsigned long long) (1 << Y) for Y
         31 might be 0xffffffff80000000.  */
      if ((code == LT_EXPR || code == GE_EXPR)
          && TYPE_UNSIGNED (TREE_TYPE (arg0))
          && CONVERT_EXPR_P (arg1)
          && TREE_CODE (TREE_OPERAND (arg1, 0)) == LSHIFT_EXPR
          && (element_precision (TREE_TYPE (arg1))
              >= element_precision (TREE_TYPE (TREE_OPERAND (arg1, 0))))
          && (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg1, 0)))
              || (element_precision (TREE_TYPE (arg1))
                  == element_precision (TREE_TYPE (TREE_OPERAND (arg1, 0)))))
          && integer_onep (TREE_OPERAND (TREE_OPERAND (arg1, 0), 0)))
        {
          tem = build2 (RSHIFT_EXPR, TREE_TYPE (arg0), arg0,
                        TREE_OPERAND (TREE_OPERAND (arg1, 0), 1));
          return build2_loc (loc, code == LT_EXPR ? EQ_EXPR : NE_EXPR, type,
                             fold_convert_loc (loc, TREE_TYPE (arg0), tem),
                             build_zero_cst (TREE_TYPE (arg0)));
        }

Mine.

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

* [Bug middle-end/101858] [12 Regression] ICE: ‘verify_gimple’ failed
  2021-08-11  7:42 [Bug c/101858] New: [12 Regression] ICE: ‘verify_gimple’ failed anbu1024.me at gmail dot com
  2021-08-11  8:07 ` [Bug c/101858] " marxin at gcc dot gnu.org
  2021-08-11  8:15 ` [Bug middle-end/101858] " rguenth at gcc dot gnu.org
@ 2021-08-11 12:01 ` cvs-commit at gcc dot gnu.org
  2021-08-11 12:01 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-11 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:d7e91f4894f6a1a2daeec5cbe1e912bb896b9f7a

commit r12-2850-gd7e91f4894f6a1a2daeec5cbe1e912bb896b9f7a
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Aug 11 10:26:18 2021 +0200

    middle-end/101858 - avoid shift of pointer in folding

    This makes sure to not generate a shift of pointer types in
    simplification of X < (cast) (1 << Y).

    2021-08-11  Richard Biener  <rguenther@suse.de>

            PR middle-end/101858
            * fold-const.c (fold_binary_loc): Guard simplification
            of  X < (cast) (1 << Y) to integer types.

            * gcc.dg/pr101858.c: New testcase.

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

* [Bug middle-end/101858] [12 Regression] ICE: ‘verify_gimple’ failed
  2021-08-11  7:42 [Bug c/101858] New: [12 Regression] ICE: ‘verify_gimple’ failed anbu1024.me at gmail dot com
                   ` (2 preceding siblings ...)
  2021-08-11 12:01 ` cvs-commit at gcc dot gnu.org
@ 2021-08-11 12:01 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-11 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
           Keywords|                            |ice-checking,
                   |                            |ice-on-valid-code
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-08-11 12:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11  7:42 [Bug c/101858] New: [12 Regression] ICE: ‘verify_gimple’ failed anbu1024.me at gmail dot com
2021-08-11  8:07 ` [Bug c/101858] " marxin at gcc dot gnu.org
2021-08-11  8:15 ` [Bug middle-end/101858] " rguenth at gcc dot gnu.org
2021-08-11 12:01 ` cvs-commit at gcc dot gnu.org
2021-08-11 12:01 ` rguenth 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).