public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/101721] New: [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006
@ 2021-08-02 10:17 asolokha at gmx dot com
  2021-08-02 12:22 ` [Bug analyzer/101721] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: asolokha at gmx dot com @ 2021-08-02 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101721
           Summary: [12 Regression] ICE in DECL_FUNCTION_CODE, at
                    tree.h:4006
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: aarch64-linux-gnu

gcc-12.0.0-alpha20210801 snapshot (g:6f0c43e97825ee54e3779afbedcd0def12443001)
ICEs when compiling the following testcase, reduced from
gcc/testsuite/gcc.target/aarch64/abs_2.c, w/ -fanalyzer:

void
foo (int vget_lane_u64___a)
{
   __builtin_aarch64_im_lane_boundsi (sizeof (vget_lane_u64___a),
     sizeof (vget_lane_u64___a), 0);
}

% aarch64-linux-gnu-gcc-12.0.0 -fanalyzer -c k1ngarza.c
during IPA pass: analyzer
k1ngarza.c: In function 'foo':
k1ngarza.c:4:4: internal compiler error: in DECL_FUNCTION_CODE, at tree.h:4006
    4 |    __builtin_aarch64_im_lane_boundsi (sizeof (vget_lane_u64___a),
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    5 |      sizeof (vget_lane_u64___a), 0);
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x80af92 DECL_FUNCTION_CODE(tree_node const*)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/tree.h:4006
0x80af92 known_allocator_p
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/sm-malloc.cc:1547
0x80af92 on_stmt
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/sm-malloc.cc:1571
0x12e6a9c ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/engine.cc:1241
0x12e8d85 ana::exploded_graph::process_node(ana::exploded_node*)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/engine.cc:3098
0x12e9672 ana::exploded_graph::process_worklist()
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/engine.cc:2684
0x12ebaef ana::impl_run_checkers(ana::logger*)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/engine.cc:4972
0x12ecb48 ana::run_checkers()
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/engine.cc:5043
0x12ddbc8 execute
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_alpha20210801/work/gcc-12-20210801/gcc/analyzer/analyzer-pass.cc:87

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

* [Bug analyzer/101721] [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006
  2021-08-02 10:17 [Bug analyzer/101721] New: [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006 asolokha at gmx dot com
@ 2021-08-02 12:22 ` rguenth at gcc dot gnu.org
  2021-08-02 15:45 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-02 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug analyzer/101721] [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006
  2021-08-02 10:17 [Bug analyzer/101721] New: [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006 asolokha at gmx dot com
  2021-08-02 12:22 ` [Bug analyzer/101721] " rguenth at gcc dot gnu.org
@ 2021-08-02 15:45 ` jakub at gcc dot gnu.org
  2021-08-02 15:55 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-08-02 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/analyzer/sm-malloc.cc.jj        2021-07-29 13:24:42.664013344 +0200
+++ gcc/analyzer/sm-malloc.cc   2021-08-02 17:42:17.312821855 +0200
@@ -1543,7 +1543,7 @@ known_allocator_p (const_tree fndecl, co

   /* ... or it is a builtin allocator that allocates objects freed with
      __builtin_free.  */
-  if (fndecl_built_in_p (fndecl))
+  if (fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
     switch (DECL_FUNCTION_CODE (fndecl))
       {
       case BUILT_IN_MALLOC:
fixes this.
As for testcase, one can use any backend builtin, e.g.
/* { dg-do compile } */
/* { dg-options "-fanalyzer" } */

void
foo ()
{
  __builtin_ia32_pause ();
}

reproduces it on x86 too.

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

* [Bug analyzer/101721] [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006
  2021-08-02 10:17 [Bug analyzer/101721] New: [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006 asolokha at gmx dot com
  2021-08-02 12:22 ` [Bug analyzer/101721] " rguenth at gcc dot gnu.org
  2021-08-02 15:45 ` jakub at gcc dot gnu.org
@ 2021-08-02 15:55 ` jakub at gcc dot gnu.org
  2021-08-03 10:45 ` cvs-commit at gcc dot gnu.org
  2021-08-03 10:51 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-08-02 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|dmalcolm at gcc dot gnu.org        |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2021-08-02
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 51242
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51242&action=edit
gcc12-pr101721.patch

Untested fix.

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

* [Bug analyzer/101721] [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006
  2021-08-02 10:17 [Bug analyzer/101721] New: [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2021-08-02 15:55 ` jakub at gcc dot gnu.org
@ 2021-08-03 10:45 ` cvs-commit at gcc dot gnu.org
  2021-08-03 10:51 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-03 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:1a830c0636472e47a7503a5ed879725149e2e728

commit r12-2685-g1a830c0636472e47a7503a5ed879725149e2e728
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Aug 3 12:44:17 2021 +0200

    analyzer: Fix ICE on MD builtin [PR101721]

    The following testcase ICEs because DECL_FUNCTION_CODE asserts the builtin
    is BUILT_IN_NORMAL, but it sees a backend (MD) builtin instead.
    The FE, normal and MD builtin numbers overlap, so one should always
    check what kind of builtin it is before looking at specific codes.

    On the other side, region-model.cc has:
          if (fndecl_built_in_p (callee_fndecl, BUILT_IN_NORMAL)
              && gimple_builtin_call_types_compatible_p (call, callee_fndecl))
            switch (DECL_UNCHECKED_FUNCTION_CODE (callee_fndecl))
    which IMO should use DECL_FUNCTION_CODE instead, it checked first it is
    a normal builtin...

    2021-08-03  Jakub Jelinek  <jakub@redhat.com>

            PR analyzer/101721
            * sm-malloc.cc (known_allocator_p): Only check DECL_FUNCTION_CODE
on
            BUILT_IN_NORMAL builtins.

            * gcc.dg/analyzer/pr101721.c: New test.

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

* [Bug analyzer/101721] [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006
  2021-08-02 10:17 [Bug analyzer/101721] New: [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2021-08-03 10:45 ` cvs-commit at gcc dot gnu.org
@ 2021-08-03 10:51 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-08-03 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-08-03 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 10:17 [Bug analyzer/101721] New: [12 Regression] ICE in DECL_FUNCTION_CODE, at tree.h:4006 asolokha at gmx dot com
2021-08-02 12:22 ` [Bug analyzer/101721] " rguenth at gcc dot gnu.org
2021-08-02 15:45 ` jakub at gcc dot gnu.org
2021-08-02 15:55 ` jakub at gcc dot gnu.org
2021-08-03 10:45 ` cvs-commit at gcc dot gnu.org
2021-08-03 10:51 ` jakub 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).