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

Reply via email to