Bug 51590 - [4.7 Regression] ICE in gsi_for_stmt, at gimple-iterator.c:560
Summary: [4.7 Regression] ICE in gsi_for_stmt, at gimple-iterator.c:560
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
: 51601 51606 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-16 21:45 UTC by Tobias Burnus
Modified: 2011-12-19 14:26 UTC (History)
3 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-12-19 00:00:00


Attachments
Test case (765 bytes, text/plain)
2011-12-16 21:47 UTC, Tobias Burnus
Details
gcc47-pr51590.patch (1.68 KB, patch)
2011-12-19 09:25 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2011-12-16 21:45:25 UTC
With 4.7.0 20111216 I get an ICE:

$ g++ -c -O3 test-it-25.ii 
test-it-25.ii: In member function 'void v8::internal::RelocIterator::next()':
test-it-25.ii:41:14: internal compiler error: in gsi_for_stmt, at gimple-iterator.c:560

But not with "-m32", "-O2" nor with GCC 4.6.2.

The failing assert is:

/* Finds iterator for STMT.  */

gimple_stmt_iterator
gsi_for_stmt (gimple stmt)
{
  ...
  gcc_unreachable ();
}
Comment 1 Tobias Burnus 2011-12-16 21:47:04 UTC
Created attachment 26116 [details]
Test case
Comment 2 Dmitry G. Dyachenko 2011-12-18 13:13:36 UTC
gcc version 4.7.0 20111218 (experimental) [trunk revision 182459] (GCC) 
Fedora 16/x64

$ cat c51590.c 
#include <sys/time.h>

extern void baz(char *);

static
void
bar( struct timeval *sv)
{
    char bt[8];
    int i;

    for(i=0; i < 8; i++)
    bt[i] = sv->tv_sec >> ( ( 7 - i ) * 8 );

    baz(bt);
}

void
foo(const char *s)
{
  struct timeval sp_cur;
  int i;

  for(i=0; *s; s++)
      i++;

  if(i != 1)
      return;

  bar(&sp_cur);
}

$ LANG=C gcc -O3 -Wall -Wextra -c c51590.c
c51590.c: In function 'foo':
c51590.c:19:1: internal compiler error: in gsi_for_stmt, at 
gimple-iterator.c:560
Comment 3 Jakub Jelinek 2011-12-19 09:23:00 UTC
*** Bug 51606 has been marked as a duplicate of this bug. ***
Comment 4 Jakub Jelinek 2011-12-19 09:25:07 UTC
Created attachment 26134 [details]
gcc47-pr51590.patch

Untested fix.
Comment 5 Jakub Jelinek 2011-12-19 11:16:11 UTC
*** Bug 51601 has been marked as a duplicate of this bug. ***
Comment 6 Jakub Jelinek 2011-12-19 14:22:36 UTC
Author: jakub
Date: Mon Dec 19 14:22:29 2011
New Revision: 182480

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182480
Log:
	PR middle-end/51590
	PR tree-optimization/51606
	* tree-vect-patterns.c (append_pattern_def_seq, new_pattern_def_seq):
	New inline functions.
	(vect_recog_over_widening_pattern,
	vect_recog_vector_vector_shift_pattern,
	vect_recog_sdivmod_pow2_pattern, vect_recog_mixed_size_cond_pattern,
	adjust_bool_pattern_cast, vect_recog_bool_pattern): Use them.

	* gcc.dg/vect/pr51590.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr51590.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-patterns.c
Comment 7 Jakub Jelinek 2011-12-19 14:26:48 UTC
Fixed.