[Bug tree-optimization/88666] New: GCC 8.2.- gets Internal Compiler Error: seg fault; GCC 8.1.0 works fine

geir at cray dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 2 19:15:00 GMT 2019


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

            Bug ID: 88666
           Summary: GCC 8.2.- gets Internal Compiler Error: seg fault;
                    GCC 8.1.0 works fine
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: geir at cray dot com
  Target Milestone: ---

Simple reproducer code causes a seg fault during compile with gcc 8.2.0. The
reproducer does not seg fault for gcc 8.1.0

$ cat repro.c
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>

int64_t foo (int64_t max, FILE *in)

{
  int64_t count = 0;
  const int64_t MAXLINE  = 1024;
  char buff[MAXLINE];

  while (!feof(in) && count < max) {
    if (fgets(buff, sizeof(buff), in) != NULL) {

      // gcc 8.2 segfaults !!
      if (strncmp (&buff[0], "QUIT", 4) == 0)
        break;

      // this is OK:
      if (strncmp (buff, "QUIT", 4) == 0)
        break;

    }
  }

  return count;
}
$ gcc --version
gcc (GCC) 8.1.0 20180502 (Cray Inc.)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -c repro.c
$ module swap gcc/8.1.0 gcc/8.2.0
$ gcc --version
gcc (GCC) 8.2.0 20180726 (Cray Inc.)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -c repro.c
during RTL pass: expand
repro.c: In function 'foo':
repro.c:17:11: internal compiler error: Segmentation fault
       if (strncmp (&buff[0], "QUIT", 4) == 0)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0xa8de4f crash_signal
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/toplev.c:325
0x6eeb25 wi::extended_tree<192>::get_len() const
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/tree.h:5572
0x6eeb25 wi::int_traits<generic_wide_int<wi::extended_tree<192> >
>::decompose(long*, unsigned int, generic_wide_int<wi::extended_tree<192> >
const&)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/wide-int.h:934
0x6eeb25 wide_int_ref_storage<true,
false>::wide_int_ref_storage<generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&, unsigned int)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/wide-int.h:983
0x6eeb25 generic_wide_int<wide_int_ref_storage<true, false>
>::generic_wide_int<generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&, unsigned int)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/wide-int.h:758
0x6eeb25 bool wi::lts_p<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/wide-int.h:1849
0x6eeb25 wi::binary_traits<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >,
wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::precision_type,
wi::int_traits<generic_wide_int<wi::extended_tree<192> >
>::precision_type>::signed_predicate_result operator<
<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/wide-int.h:3170
0x6eeb25 tree_int_cst_lt(tree_node const*, tree_node const*)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/tree.h:5728
0x6eeb25 maybe_warn_nonstring_arg(tree_node*, tree_node*)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/calls.c:1716
0x6f053a maybe_warn_nonstring_arg(tree_node*, tree_node*)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/calls.c:1627
0x6f053a initialize_argument_information
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/calls.c:2321
0x6f053a expand_call(tree_node*, rtx_def*, int)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/calls.c:3713
0x6e4286 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/builtins.c:6656
0x7f1679 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/expr.c:11005
0x7fa35b store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool,
tree_node*)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/expr.c:5635
0x7fb5b3 expand_assignment(tree_node*, tree_node*, bool)
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/expr.c:5403
0x7015d8 expand_call_stmt
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/cfgexpand.c:2688
0x7015d8 expand_gimple_stmt_1
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/cfgexpand.c:3624
0x7015d8 expand_gimple_stmt
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/cfgexpand.c:3790
0x70287f expand_gimple_basic_block
        ../../cray-gcc-8.2.0-201808172015.9a091ef8ec76a/gcc/cfgexpand.c:5819
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$


More information about the Gcc-bugs mailing list