public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106616] New: ia64: ICE during RTL pass: mach: error: qsort comparator non-negative on sorted output: 3
@ 2022-08-14 19:02 slyfox at gcc dot gnu.org
  2022-08-14 19:08 ` [Bug target/106616] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-08-14 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106616
           Summary: ia64: ICE during RTL pass: mach: error: qsort
                    comparator non-negative on sorted output: 3
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---
            Target: ia64-unknown-linux-gnu

Observed this ICE on this week's ia64-gcc when was building linux4.19 for ia64
target. Here is extracted reproducer:

// $ cat feat.c.c
//
/nix/store/pmvcr7vxqwi1jsykn0p9xw9446linswp-ia64-unknown-linux-gnu-stage-final-gcc-wrapper-13.0.0/bin/ia64-unknown-linux-gnu-gcc
-O2 -c feat.c.c -o bug.o

int inet_csk_schedule_ack(int);
int dccp_feat_nn_get(int, int);

struct sock_common;

struct list_head {
  struct list_head *next;
};
enum { DCCPF_SEQUENCE_WINDOW, DCCPF_ACK_RATIO };
struct dccp_sock {
  int dccps_inet_connection;
  struct list_head dccps_featneg;
  struct list_head node;
} * dccp_feat_signal_nn_change_feat_entry;

int dccp_feat_list_lookup_feat_num, dccp_feat_list_lookup_is_local,
    dccp_feat_is_valid_nn_val_feat_num, dccp_feat_is_valid_nn_val_val,
    dccp_feat_signal_nn_change_feat___trans_tmp_1;

int dccp_feat_is_valid_nn_val(void) {
  switch (dccp_feat_is_valid_nn_val_feat_num) {
  case DCCPF_ACK_RATIO:
    return dccp_feat_is_valid_nn_val_val <= 5;
  case DCCPF_SEQUENCE_WINDOW:
    return dccp_feat_is_valid_nn_val_val <= 5ull;
  }
  return 0;
}
int dccp_feat_signal_nn_change_feat(struct sock_common *sk) {
  struct list_head *fn = &((struct dccp_sock *)sk)->dccps_featneg;
  if (!dccp_feat_is_valid_nn_val())
    return 2;
  if (dccp_feat_nn_get((int)(long)sk,
(int)(long)dccp_feat_signal_nn_change_feat))
    return 0;
  char entry_0;
  dccp_feat_signal_nn_change_feat_entry = ({ (struct dccp_sock*)fn->next; });
  for (; &dccp_feat_signal_nn_change_feat_entry->node == fn;
       dccp_feat_signal_nn_change_feat_entry = 0)
    if (entry_0 == dccp_feat_list_lookup_feat_num &&
        dccp_feat_list_lookup_is_local)
      ;
    else if (entry_0 > dccp_feat_list_lookup_feat_num)
      dccp_feat_signal_nn_change_feat___trans_tmp_1 = 0;
  inet_csk_schedule_ack((int)(long)sk);
  return (int)(long)fn;
}

Crashing:

$ ia64-unknown-linux-gnu-gcc -O2 -c feat.c.c -o bug.o  -Wall

feat.c.c: In function 'dccp_feat_signal_nn_change_feat':
feat.c.c:41:17: warning: 'entry_0' may be used uninitialized
[-Wmaybe-uninitialized]
   41 |     if (entry_0 == dccp_feat_list_lookup_feat_num &&
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
feat.c.c:37:8: note: 'entry_0' was declared here
   37 |   char entry_0;
      |        ^~~~~~~
feat.c.c:48:1: error: qsort comparator non-negative on sorted output: 3
   48 | }
      | ^
during RTL pass: mach
feat.c.c:48:1: internal compiler error: qsort checking failed
0x187ff57 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
        ???:0
0x1880da7 internal_error(char const*, ...)
        ???:0
0x7be301 qsort_chk_error(void const*, void const*, void const*, int (*)(void
const*, void const*, void*), void*)
        ???:0
0x7be429 qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*,
void const*, void*), void*) [clone .cold]
        ???:0
0x18b46e8 gcc_qsort(void*, unsigned long, unsigned long, int (*)(void const*,
void const*))
        ???:0
0x16c6a27 ready_sort_real(ready_list*) [clone .constprop.0]
        ???:0
0x16ceb64 schedule_block(basic_block_def**, void*)
        ???:0
0x17a8b58 schedule_ebb(rtx_insn*, rtx_insn*, bool)
        ???:0
0x17a9149 schedule_ebbs()
        ???:0
0x1191baf ia64_reorg()
        ???:0
0xda5e49 (anonymous namespace)::pass_machine_reorg::execute(function*)
        ???:0

$ ia64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/ia64-unknown-linux-gnu-stage-final-gcc-13.0.0/bin/ia64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/ia64-unknown-linux-gnu-stage-final-gcc-13.0.0/libexec/gcc/ia64-unknown-linux-gnu/13.0.0/lto-wrapper
Target: ia64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220807 (experimental) (GCC)

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

* [Bug target/106616] ia64: ICE during RTL pass: mach: error: qsort comparator non-negative on sorted output: 3
  2022-08-14 19:02 [Bug target/106616] New: ia64: ICE during RTL pass: mach: error: qsort comparator non-negative on sorted output: 3 slyfox at gcc dot gnu.org
@ 2022-08-14 19:08 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-14 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 87281

*** This bug has been marked as a duplicate of bug 87281 ***

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

end of thread, other threads:[~2022-08-14 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-14 19:02 [Bug target/106616] New: ia64: ICE during RTL pass: mach: error: qsort comparator non-negative on sorted output: 3 slyfox at gcc dot gnu.org
2022-08-14 19:08 ` [Bug target/106616] " pinskia 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).