public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf
@ 2022-12-15 20:30 ucko at ncbi dot nlm.nih.gov
  2022-12-15 21:59 ` [Bug tree-optimization/108137] [12/13 " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: ucko at ncbi dot nlm.nih.gov @ 2022-12-15 20:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108137
           Summary: [12 Regression] ICE: segfault during GIMPLE pass:
                    warn-printf
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ucko at ncbi dot nlm.nih.gov
  Target Milestone: ---

Created attachment 54105
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54105&action=edit
-freport-bug output

I encountered a GCC crash with the below backtrace when compiling with -Wall
code I was able to reduce to

#include <stdio.h>

void f(unsigned short x_port, unsigned int x_host)
{
    printf("missing %s", x_port ? "host" : &"host:port"[x_host ? 5 : 0]);
}

(full -freport-bug output attached).

Could someone please take a look?

Thanks!

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

during GIMPLE pass: warn-printf
/home/ucko/tmp/ncbi_socket.c: In function 'f':
/home/ucko/tmp/ncbi_socket.c:6:1: internal compiler error: Segmentation fault
    6 | }
      | ^
0x19c32b4 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
        ???:0
0x19c3f06 internal_error(char const*, ...)
        ???:0
0xc4624f crash_signal(int)
        ???:0
0xf0fde2 wi::lts_p_large(long const*, unsigned int, unsigned int, long const*,
unsigned int)
        ???:0
0xdf7a69 get_range_strlen_dynamic(tree_node*, gimple*, c_strlen_data*,
bitmap_head*, pointer_query*, unsigned int*)
        ???:0
0xdf8333 get_range_strlen_dynamic(tree_node*, gimple*, c_strlen_data*,
pointer_query&)
        ???:0
0x18483a6 (anonymous namespace)::format_string((anonymous namespace)::directive
const&, tree_node*, pointer_query&)
        ???:0
0x184584e handle_printf_call(gimple_stmt_iterator*, pointer_query&)
        ???:0
0xdffb45 strlen_pass::check_and_optimize_call(bool*)
        ???:0
0xe00491 strlen_pass::check_and_optimize_stmt(bool*)
        ???:0
0xe00874 strlen_pass::before_dom_children(basic_block_def*)
        ???:0
0x17e6bae dom_walker::walk(basic_block_def*)
        ???:0
0xe00bbc (anonymous namespace)::printf_strlen_execute(function*, bool)
        ???:0

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
@ 2022-12-15 21:59 ` pinskia at gcc dot gnu.org
  2022-12-15 22:07 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-15 21:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12 Regression] ICE:        |[12/13 Regression] ICE:
                   |segfault during GIMPLE      |segfault during GIMPLE
                   |pass: warn-printf           |pass: warn-printf
   Last reconfirmed|                            |2022-12-15
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Trunk says:

<source>:7:1: internal compiler error: tree check: expected integer_cst, have
cond_expr in get_len, at tree.h:6285
    7 | }
      | ^

Confirmed.

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
  2022-12-15 21:59 ` [Bug tree-optimization/108137] [12/13 " pinskia at gcc dot gnu.org
@ 2022-12-15 22:07 ` pinskia at gcc dot gnu.org
  2022-12-15 23:02 ` ucko at ncbi dot nlm.nih.gov
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-15 22:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
  2022-12-15 21:59 ` [Bug tree-optimization/108137] [12/13 " pinskia at gcc dot gnu.org
  2022-12-15 22:07 ` pinskia at gcc dot gnu.org
@ 2022-12-15 23:02 ` ucko at ncbi dot nlm.nih.gov
  2022-12-16 12:29 ` [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69 marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ucko at ncbi dot nlm.nih.gov @ 2022-12-15 23:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from ucko at ncbi dot nlm.nih.gov ---
Thanks for looking into this report promptly, and sorry for getting  the
component wrong; I wasn't sure what would be the best fit here.  Also, please
note that the reported line number is the last line of the file, which in my
unreduced test case is well after the code triggering this bug.

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (2 preceding siblings ...)
  2022-12-15 23:02 ` ucko at ncbi dot nlm.nih.gov
@ 2022-12-16 12:29 ` marxin at gcc dot gnu.org
  2022-12-16 12:38 ` marxin at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-16 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression] ICE:     |[12/13 Regression] ICE:
                   |segfault during GIMPLE      |segfault during GIMPLE
                   |pass: warn-printf           |pass: warn-printf since
                   |                            |r12-523-g2254b3233b5bfa69
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-523-g2254b3233b5bfa69.

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (3 preceding siblings ...)
  2022-12-16 12:29 ` [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69 marxin at gcc dot gnu.org
@ 2022-12-16 12:38 ` marxin at gcc dot gnu.org
  2022-12-20 16:38 ` ucko at ncbi dot nlm.nih.gov
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-16 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
I can fix that.

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (4 preceding siblings ...)
  2022-12-16 12:38 ` marxin at gcc dot gnu.org
@ 2022-12-20 16:38 ` ucko at ncbi dot nlm.nih.gov
  2022-12-21 12:43 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ucko at ncbi dot nlm.nih.gov @ 2022-12-20 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from ucko at ncbi dot nlm.nih.gov ---
> --- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
> I can fix that.

That would be great, thanks; I can fairly easily work around this bug in the
file where I first hit it, but we have another (non-public) file that's much
more severely affected.  Our sysadmins are prepared to supply test
installations incorporating any patches you draft.

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (5 preceding siblings ...)
  2022-12-20 16:38 ` ucko at ncbi dot nlm.nih.gov
@ 2022-12-21 12:43 ` rguenth at gcc dot gnu.org
  2022-12-27 15:07 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-21 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (6 preceding siblings ...)
  2022-12-21 12:43 ` rguenth at gcc dot gnu.org
@ 2022-12-27 15:07 ` marxin at gcc dot gnu.org
  2022-12-28  8:15 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-27 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Patch candidate:
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/609060.html

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

* [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (7 preceding siblings ...)
  2022-12-27 15:07 ` marxin at gcc dot gnu.org
@ 2022-12-28  8:15 ` cvs-commit at gcc dot gnu.org
  2022-12-28  8:15 ` [Bug tree-optimization/108137] [12 " marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-28  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

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

commit r13-4911-gee6f262b87fef590729e96e999f1c3b207c251c0
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Dec 23 15:27:32 2022 +0100

    strlen: do not use cond_expr for boundaries

            PR tree-optimization/108137

    gcc/ChangeLog:

            * tree-ssa-strlen.cc (get_range_strlen_phi): Reject anything
            different from INTEGER_CST.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr108137.c: New test.

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

* [Bug tree-optimization/108137] [12 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (8 preceding siblings ...)
  2022-12-28  8:15 ` cvs-commit at gcc dot gnu.org
@ 2022-12-28  8:15 ` marxin at gcc dot gnu.org
  2023-01-10 15:43 ` ucko at ncbi dot nlm.nih.gov
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-28  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression] ICE:     |[12 Regression] ICE:
                   |segfault during GIMPLE      |segfault during GIMPLE
                   |pass: warn-printf since     |pass: warn-printf since
                   |r12-523-g2254b3233b5bfa69   |r12-523-g2254b3233b5bfa69
      Known to work|                            |13.0

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master so far.

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

* [Bug tree-optimization/108137] [12 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (9 preceding siblings ...)
  2022-12-28  8:15 ` [Bug tree-optimization/108137] [12 " marxin at gcc dot gnu.org
@ 2023-01-10 15:43 ` ucko at ncbi dot nlm.nih.gov
  2023-01-11 10:29 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ucko at ncbi dot nlm.nih.gov @ 2023-01-10 15:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from ucko at ncbi dot nlm.nih.gov ---
Thanks!  I'm happy to confirm that the patch works for me too, even in the more
severely affected file I mentioned earlier.

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

* [Bug tree-optimization/108137] [12 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (10 preceding siblings ...)
  2023-01-10 15:43 ` ucko at ncbi dot nlm.nih.gov
@ 2023-01-11 10:29 ` marxin at gcc dot gnu.org
  2023-01-11 11:27 ` cvs-commit at gcc dot gnu.org
  2023-01-11 11:27 ` marxin at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-11 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
Great, glad to hear that. I'm testing the backport to gcc-12 branch right now.

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

* [Bug tree-optimization/108137] [12 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (11 preceding siblings ...)
  2023-01-11 10:29 ` marxin at gcc dot gnu.org
@ 2023-01-11 11:27 ` cvs-commit at gcc dot gnu.org
  2023-01-11 11:27 ` marxin at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-11 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Martin Liska
<marxin@gcc.gnu.org>:

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

commit r12-9040-gbd4c310b06d747975853ac6dfef6da120c13f6ec
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Dec 23 15:27:32 2022 +0100

    strlen: do not use cond_expr for boundaries

            PR tree-optimization/108137

    gcc/ChangeLog:

            * tree-ssa-strlen.cc (get_range_strlen_phi): Reject anything
            different from INTEGER_CST.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr108137.c: New test.

    (cherry picked from commit ee6f262b87fef590729e96e999f1c3b207c251c0)

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

* [Bug tree-optimization/108137] [12 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69
  2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
                   ` (12 preceding siblings ...)
  2023-01-11 11:27 ` cvs-commit at gcc dot gnu.org
@ 2023-01-11 11:27 ` marxin at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-11 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #12 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-01-11 11:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 20:30 [Bug c/108137] New: [12 Regression] ICE: segfault during GIMPLE pass: warn-printf ucko at ncbi dot nlm.nih.gov
2022-12-15 21:59 ` [Bug tree-optimization/108137] [12/13 " pinskia at gcc dot gnu.org
2022-12-15 22:07 ` pinskia at gcc dot gnu.org
2022-12-15 23:02 ` ucko at ncbi dot nlm.nih.gov
2022-12-16 12:29 ` [Bug tree-optimization/108137] [12/13 Regression] ICE: segfault during GIMPLE pass: warn-printf since r12-523-g2254b3233b5bfa69 marxin at gcc dot gnu.org
2022-12-16 12:38 ` marxin at gcc dot gnu.org
2022-12-20 16:38 ` ucko at ncbi dot nlm.nih.gov
2022-12-21 12:43 ` rguenth at gcc dot gnu.org
2022-12-27 15:07 ` marxin at gcc dot gnu.org
2022-12-28  8:15 ` cvs-commit at gcc dot gnu.org
2022-12-28  8:15 ` [Bug tree-optimization/108137] [12 " marxin at gcc dot gnu.org
2023-01-10 15:43 ` ucko at ncbi dot nlm.nih.gov
2023-01-11 10:29 ` marxin at gcc dot gnu.org
2023-01-11 11:27 ` cvs-commit at gcc dot gnu.org
2023-01-11 11:27 ` marxin 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).