This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/68036] New: ICE on valid code at -Os and above on x86_64-linux-gnu


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

            Bug ID: 68036
           Summary: ICE on valid code at -Os and above on x86_64-linux-gnu
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk at
-Os and above on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It is a regression from 5.2.x.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20151020 (experimental) [trunk revision 229078] (GCC) 
$ 
$ gcc-trunk -O1 -c small.c
$ gcc-5.2 -Os -c small.c
$ 
$ gcc-trunk -Os -c small.c
small.c: In function âfn1â:
small.c:4:1: internal compiler error: Segmentation fault
 fn1 ()
 ^
0xad1c3f crash_signal
        ../../gcc-trunk/gcc/toplev.c:353
0x825b65 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-trunk/gcc/tree.h:3055
0x825b65 tree_single_nonnegative_warnv_p(tree_node*, bool*, int)
        ../../gcc-trunk/gcc/fold-const.c:13025
0x884092 gimple_phi_nonnegative_warnv_p
        ../../gcc-trunk/gcc/gimple-fold.c:6239
0x884092 gimple_stmt_nonnegative_warnv_p(gimple*, bool*, int)
        ../../gcc-trunk/gcc/gimple-fold.c:6264
0x825da4 tree_expr_nonnegative_p(tree_node*)
        ../../gcc-trunk/gcc/fold-const.c:13325
0xe5c007 gimple_simplify_108
        /tmp/objdir/gcc/gimple-match.c:5116
0xe5ccd3 gimple_simplify_TRUNC_MOD_EXPR
        /tmp/objdir/gcc/gimple-match.c:24762
0xe259a5 gimple_simplify
        /tmp/objdir/gcc/gimple-match.c:34389
0xe2772f gimple_resimplify2(gimple**, code_helper*, tree_node*, tree_node**,
tree_node* (*)(tree_node*))
        ../../gcc-trunk/gcc/gimple-match-head.c:193
0xe6d583 gimple_simplify(gimple*, code_helper*, tree_node**, gimple**,
tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
        ../../gcc-trunk/gcc/gimple-match-head.c:668
0x88ca51 fold_stmt_1
        ../../gcc-trunk/gcc/gimple-fold.c:3605
0xb0dc64 replace_uses_by(tree_node*, tree_node*)
        ../../gcc-trunk/gcc/tree-cfg.c:1835
0xb0ebac gimple_merge_blocks
        ../../gcc-trunk/gcc/tree-cfg.c:1921
0x70a9a5 merge_blocks(basic_block_def*, basic_block_def*)
        ../../gcc-trunk/gcc/cfghooks.c:776
0xb180fd cleanup_tree_cfg_bb
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:654
0xb18cf8 cleanup_tree_cfg_1
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:686
0xb18cf8 cleanup_tree_cfg_noloop
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:738
0xb18cf8 cleanup_tree_cfg()
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:793
0xa0afc4 execute_function_todo
        ../../gcc-trunk/gcc/passes.c:1920
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 


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


int a, b, c, d, e, j; 

void
fn1 ()
{
  int f = 0;
  for (; j;)
    {
      int g;
      if (a)
        for (;; g++)
          {
            int h = -1;
            if (d)
              {
                while (f < h)
                  {
                    for (; c;)
                      g = 0;
                    b = 0;
                  }
                int i = 0;
                e = g % i;
              }
          }
      for (; f >= 0; f--)
        ;
    }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]