public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/113999] New: [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c
@ 2024-02-19 17:19 zsojka at seznam dot cz
  2024-02-19 19:07 ` [Bug analyzer/113999] " dmalcolm at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2024-02-19 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113999
           Summary: [14 Regression] ICE: in
                    string_cst_has_null_terminator, at
                    analyzer/region-model.cc:3651 with -fanalyzer on
                    gcc.dg/tree-ssa/strncpy-2.c
           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 57464
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57464&action=edit
auto-reduced testcase

Maybe related to PR113998

Compiler output:
$ x86_64-pc-linux-gnu-gcc -fanalyzer gcc.dg/tree-ssa/strncpy-2.c
during IPA pass: analyzer
gcc.dg/tree-ssa/strncpy-2.c: In function 'main':
gcc.dg/tree-ssa/strncpy-2.c:24:15: internal compiler error: in
string_cst_has_null_terminator, at analyzer/region-model.cc:3651
   24 |   size_t n1 = __builtin_strlen (a);
      |               ^~~~~~~~~~~~~~~~~~~~
0x8c3351 string_cst_has_null_terminator
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:3651
0x195c069 svalue_byte_range_has_null_terminator_1
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:3712
0x195c069 svalue_byte_range_has_null_terminator
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:3809
0x195c3c8 svalue_byte_range_has_null_terminator_1
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:3774
0x195c3c8 svalue_byte_range_has_null_terminator
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:3809
0x1969838 ana::region_model::scan_for_null_terminator_1(ana::region const*,
tree_node*, ana::svalue const**, ana::region_model_context*) const
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:4066
0x196a67e
ana::region_model::check_for_null_terminated_string_arg(ana::call_details
const&, unsigned int, bool, ana::svalue const**) const
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:4337
0x1945766 ana::kf_strlen::impl_call_pre(ana::call_details const&) const
        /repo/gcc-trunk/gcc/analyzer/kf.cc:1389
0x1961a57 ana::region_model::on_call_pre(gcall const*,
ana::region_model_context*)
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:1700
0x196600a ana::region_model::on_stmt_pre(gimple const*, bool*,
ana::region_model_context*)
        /repo/gcc-trunk/gcc/analyzer/region-model.cc:1337
0x192cf70 ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*, bool*,
ana::path_context*)
        /repo/gcc-trunk/gcc/analyzer/engine.cc:1512
0x192ff05 ana::exploded_graph::process_node(ana::exploded_node*)
        /repo/gcc-trunk/gcc/analyzer/engine.cc:4124
0x1930e3a ana::exploded_graph::process_worklist()
        /repo/gcc-trunk/gcc/analyzer/engine.cc:3515
0x19335a3 ana::impl_run_checkers(ana::logger*)
        /repo/gcc-trunk/gcc/analyzer/engine.cc:6209
0x19344b6 ana::run_checkers()
        /repo/gcc-trunk/gcc/analyzer/engine.cc:6300
0x1922e58 execute
        /repo/gcc-trunk/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
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-9062-20240219114159-geb17bdc211a-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-9062-20240219114159-geb17bdc211a-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240219 (experimental) (GCC)

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

* [Bug analyzer/113999] [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c
  2024-02-19 17:19 [Bug analyzer/113999] New: [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c zsojka at seznam dot cz
@ 2024-02-19 19:07 ` dmalcolm at gcc dot gnu.org
  2024-02-20  8:10 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-02-19 19:07 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-19
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this bug report.

Confirmed affects trunk:
  https://godbolt.org/z/ao1a7xchq
and doesn't affect GCC 13.

Am investigating.

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

* [Bug analyzer/113999] [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c
  2024-02-19 17:19 [Bug analyzer/113999] New: [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c zsojka at seznam dot cz
  2024-02-19 19:07 ` [Bug analyzer/113999] " dmalcolm at gcc dot gnu.org
@ 2024-02-20  8:10 ` rguenth at gcc dot gnu.org
  2024-02-21  0:46 ` cvs-commit at gcc dot gnu.org
  2024-02-21  0:52 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-20  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

* [Bug analyzer/113999] [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c
  2024-02-19 17:19 [Bug analyzer/113999] New: [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c zsojka at seznam dot cz
  2024-02-19 19:07 ` [Bug analyzer/113999] " dmalcolm at gcc dot gnu.org
  2024-02-20  8:10 ` rguenth at gcc dot gnu.org
@ 2024-02-21  0:46 ` cvs-commit at gcc dot gnu.org
  2024-02-21  0:52 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-21  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:0a6a5f8656ccf9a60ac516c68cd4eb40ff4630c4

commit r14-9091-g0a6a5f8656ccf9a60ac516c68cd4eb40ff4630c4
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Tue Feb 20 19:44:51 2024 -0500

    analyzer: handle array-initialization from a string_cst [PR113999]

    gcc/analyzer/ChangeLog:
            PR analyzer/113999
            * analyzer.h (get_string_cst_size): New decl.
            * region-model-manager.cc (get_string_cst_size): New.
            (region_model_manager::maybe_get_char_from_string_cst): Treat
            single-byte accesses within string_cst but beyond
            TREE_STRING_LENGTH as being 0.
            * region-model.cc (string_cst_has_null_terminator): Likewise.

    gcc/testsuite/ChangeLog:
            PR analyzer/113999
            * c-c++-common/analyzer/strlen-pr113999.c: New test.
            * gcc.dg/analyzer/strlen-1.c: More test coverage.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

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

* [Bug analyzer/113999] [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c
  2024-02-19 17:19 [Bug analyzer/113999] New: [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-02-21  0:46 ` cvs-commit at gcc dot gnu.org
@ 2024-02-21  0:52 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-02-21  0:52 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

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

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed by the above patch; marking as resolved.

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

end of thread, other threads:[~2024-02-21  0:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19 17:19 [Bug analyzer/113999] New: [14 Regression] ICE: in string_cst_has_null_terminator, at analyzer/region-model.cc:3651 with -fanalyzer on gcc.dg/tree-ssa/strncpy-2.c zsojka at seznam dot cz
2024-02-19 19:07 ` [Bug analyzer/113999] " dmalcolm at gcc dot gnu.org
2024-02-20  8:10 ` rguenth at gcc dot gnu.org
2024-02-21  0:46 ` cvs-commit at gcc dot gnu.org
2024-02-21  0:52 ` dmalcolm 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).