public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer
@ 2024-02-18 19:38 zsojka at seznam dot cz
  2024-02-18 19:42 ` [Bug analyzer/113983] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2024-02-18 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113983
           Summary: [14 Regression] ICE: tree check: expected integer_cst,
                    have vector_cst in
                    maybe_undo_optimize_bit_field_compare, at
                    analyzer/region-model-manager.cc:606 with -fanalyzer
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 57457
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57457&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -fanalyzer testcase.c 
during IPA pass: analyzer
testcase.c: In function 'foo':
testcase.c:8:22: internal compiler error: tree check: expected integer_cst,
have vector_cst in maybe_undo_optimize_bit_field_compare, at
analyzer/region-model-manager.cc:606
    8 |   return (0, 0) * (i & v);
      |                   ~~~^~~~
0x88ddd5 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /repo/gcc-trunk/gcc/tree.cc:8955

testcase.c:8:22: internal compiler error: Segmentation fault
0x151aef2 crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:317
0x2aec460 x86_64_fallback_frame_state
        ./md-unwind-support.h:63
0x2aec460 uw_frame_state_for
        /repo/gcc-trunk/libgcc/unwind-dw2.c:1013
0x2aed79d _Unwind_Backtrace
        /repo/gcc-trunk/libgcc/unwind.inc:303
0x2a97f89 backtrace_full
        /repo/gcc-trunk/libbacktrace/backtrace.c:127
0x29ff2a6 diagnostic_context::action_after_output(diagnostic_t)
        /repo/gcc-trunk/gcc/diagnostic.cc:781
0x29ff4bb diagnostic_action_after_output(diagnostic_context*, diagnostic_t)
        /repo/gcc-trunk/gcc/diagnostic.h:1002
0x29ff4bb diagnostic_context::report_diagnostic(diagnostic_info*)
        /repo/gcc-trunk/gcc/diagnostic.cc:1633
0x29ff838 diagnostic_impl
        /repo/gcc-trunk/gcc/diagnostic.cc:1767
0x29fff06 internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic.cc:2225
0x88ddd5 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /repo/gcc-trunk/gcc/tree.cc:8955
x86_64-pc-linux-gnu-gcc: internal compiler error: Segmentation fault signal
terminated program cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-9043-20240217001708-gd70f155b074-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-9043-20240217001708-gd70f155b074-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240217 (experimental) (GCC)

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

* [Bug analyzer/113983] [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer
  2024-02-18 19:38 [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer zsojka at seznam dot cz
@ 2024-02-18 19:42 ` pinskia at gcc dot gnu.org
  2024-02-18 19:44 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-18 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Let me look since I touched maybe_undo_optimize_bit_field_compare last.

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

* [Bug analyzer/113983] [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer
  2024-02-18 19:38 [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer zsojka at seznam dot cz
  2024-02-18 19:42 ` [Bug analyzer/113983] " pinskia at gcc dot gnu.org
@ 2024-02-18 19:44 ` pinskia at gcc dot gnu.org
  2024-02-19 20:40 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-18 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-18
                 CC|                            |dmalcolm at gcc dot gnu.org
           Assignee|dmalcolm at gcc dot gnu.org        |pinskia at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Almost definitely introduced by r14-6419-g4eaaf7f5a378e8.

Fix:
[apinski@xeond2 gcc]$ git diff
diff --git a/gcc/analyzer/region-model-manager.cc
b/gcc/analyzer/region-model-manager.cc
index 62f808a81c2..21e13b48025 100644
--- a/gcc/analyzer/region-model-manager.cc
+++ b/gcc/analyzer/region-model-manager.cc
@@ -602,6 +602,9 @@ maybe_undo_optimize_bit_field_compare (tree type,
                                       tree cst,
                                       const svalue *arg1)
 {
+  if (!INTEGRAL_TYPE_P (type))
+    return NULL;
+
   const binding_map &map = compound_sval->get_map ();
   unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (cst);
   /* If "mask" is a contiguous range of set bits, see if the

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

* [Bug analyzer/113983] [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer
  2024-02-18 19:38 [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer zsojka at seznam dot cz
  2024-02-18 19:42 ` [Bug analyzer/113983] " pinskia at gcc dot gnu.org
  2024-02-18 19:44 ` pinskia at gcc dot gnu.org
@ 2024-02-19 20:40 ` cvs-commit at gcc dot gnu.org
  2024-02-19 20:41 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-19 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r14-9074-gd70facd54a576faca1bfba96e92e1475e0da22a3
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Sun Feb 18 14:14:23 2024 -0800

    analyzer: Fix maybe_undo_optimize_bit_field_compare vs non-scalar types
[PR113983]

    After r14-6419-g4eaaf7f5a378e8, maybe_undo_optimize_bit_field_compare would
ICE on
    vector CST but this function really should be checking if we had integer
types so
    reject non-integral types early on (like it was doing for non-char type
before r14-6419-g4eaaf7f5a378e8).

    Committed as obvious after build and tested for aarch64-linux-gnu with no
regressions.

            PR analyzer/113983

    gcc/analyzer/ChangeLog:

            * region-model-manager.cc (maybe_undo_optimize_bit_field_compare):
Reject
            non integral types.

    gcc/testsuite/ChangeLog:

            * gcc.dg/analyzer/torture/vector-extract-1.c: New test.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>

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

* [Bug analyzer/113983] [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer
  2024-02-18 19:38 [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-02-19 20:40 ` cvs-commit at gcc dot gnu.org
@ 2024-02-19 20:41 ` pinskia at gcc dot gnu.org
  2024-02-19 20:43 ` dmalcolm at gcc dot gnu.org
  2024-02-20  9:33 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-19 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug analyzer/113983] [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer
  2024-02-18 19:38 [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2024-02-19 20:41 ` pinskia at gcc dot gnu.org
@ 2024-02-19 20:43 ` dmalcolm at gcc dot gnu.org
  2024-02-20  9:33 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-02-19 20:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> Fixed.

Thanks!

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

* [Bug analyzer/113983] [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer
  2024-02-18 19:38 [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2024-02-19 20:43 ` dmalcolm at gcc dot gnu.org
@ 2024-02-20  9:33 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-20  9:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC 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:ecfcc362b7f3f796c72f3525c4e3a6dd8ab3beac

commit r14-9079-gecfcc362b7f3f796c72f3525c4e3a6dd8ab3beac
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Feb 20 10:31:46 2024 +0100

    testsuite: Fix up analyzer/torture/vector-extract-1.c test for i686
[PR113983]

    The testcase fails on i686-linux with
    .../gcc/testsuite/gcc.dg/analyzer/torture/vector-extract-1.c:11:1: warning:
MMX vector return without MMX enabled changes the ABI [-Wpsabi]
    Added -Wno-psabi to silence the warning.

    2024-02-20  Jakub Jelinek  <jakub@redhat.com>

            PR analyzer/113983
            * gcc.dg/analyzer/torture/vector-extract-1.c: Add -Wno-psabi as
            dg-additional-options.

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

end of thread, other threads:[~2024-02-20  9:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18 19:38 [Bug analyzer/113983] New: [14 Regression] ICE: tree check: expected integer_cst, have vector_cst in maybe_undo_optimize_bit_field_compare, at analyzer/region-model-manager.cc:606 with -fanalyzer zsojka at seznam dot cz
2024-02-18 19:42 ` [Bug analyzer/113983] " pinskia at gcc dot gnu.org
2024-02-18 19:44 ` pinskia at gcc dot gnu.org
2024-02-19 20:40 ` cvs-commit at gcc dot gnu.org
2024-02-19 20:41 ` pinskia at gcc dot gnu.org
2024-02-19 20:43 ` dmalcolm at gcc dot gnu.org
2024-02-20  9:33 ` cvs-commit 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).