User account creation filtered due to spam.

Bug 56984 - [4.8/4.9 Regression] ICE in tree_vrp.c
Summary: [4.8/4.9 Regression] ICE in tree_vrp.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.1
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2013-04-17 02:45 UTC by Ishiura Lab Compiler Team
Modified: 2013-04-18 08:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-04-17 00:00:00


Attachments
gcc49-pr56984.patch (583 bytes, patch)
2013-04-17 07:30 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ishiura Lab Compiler Team 2013-04-17 02:45:18 UTC
GCC 4.8.0 with "-O1 -ftree-vrp" option ICEs on 
the following code where sizeof(int) == 4.
The failure occurs in Linux (x86_64 and i686)
and Mac OS X (x86_64).

  $ cat error.c

  int g = 0;
  int main(void)
    {
    if ( (g>>31) < -1 ) { g++; }
    return 0;
  }

  $ x86_64-unknown-linux-gnu-gcc-4.8.0 error.c -O1 -ftree-vrp
  error.c: In function 'main':
  error.c:3:5: internal compiler error: in remove_range_assertions, at
  tree-vrp.c:6276
   int main(void)
       ^
  0x936e7e remove_range_assertions
  ../../gcc/tree-vrp.c:6276
  0x936e7e execute_vrp
  ../../gcc/tree-vrp.c:9299
  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.
Comment 1 Jakub Jelinek 2013-04-17 06:23:02 UTC
Started with http://gcc.gnu.org/r184927
Comment 2 Jakub Jelinek 2013-04-17 07:30:20 UTC
Created attachment 29887 [details]
gcc49-pr56984.patch

Untested fix.  Another thing is that fold resp. gimple_fold aren't able to optimize (x >> N) < M into 0 if M << N is the minimum value, but that isn't something VRP should handle.
Comment 3 Jakub Jelinek 2013-04-18 08:02:24 UTC
Author: jakub
Date: Thu Apr 18 07:54:58 2013
New Revision: 198051

URL: http://gcc.gnu.org/viewcvs?rev=198051&root=gcc&view=rev
Log:
	PR tree-optimization/56984
	* tree-vrp.c (register_edge_assert_for_2): For (x >> M) < N
	and (x >> M) >= N don't register any assertion if N << M is the
	minimum value.

	* gcc.c-torture/compile/pr56984.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr56984.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c

Author: jakub
Date: Thu Apr 18 07:56:03 2013
New Revision: 198052

URL: http://gcc.gnu.org/viewcvs?rev=198052&root=gcc&view=rev
Log:
	PR tree-optimization/56984
	* tree-vrp.c (register_edge_assert_for_2): For (x >> M) < N
	and (x >> M) >= N don't register any assertion if N << M is the
	minimum value.

	* gcc.c-torture/compile/pr56984.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/compile/pr56984.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-vrp.c