Bug 78121 - [7 Regression] ice in set_value_range
Summary: [7 Regression] ice in set_value_range
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: 7.0
Assignee: kugan
URL:
Keywords: ice-on-valid-code
: 78258 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-26 21:32 UTC by David Binderman
Modified: 2016-11-15 21:12 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
C source code (28.28 KB, text/plain)
2016-10-26 21:32 UTC, David Binderman
Details
untested patch (1.03 KB, patch)
2016-10-27 05:07 UTC, kugan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2016-10-26 21:32:25 UTC
Created attachment 39902 [details]
C source code

The attached code, when compiled by gcc dated 20161026, and compiler
flags -O2 -ansi, does this:

$ ../results/bin/gcc -c -ansi -O2 bug317.c 2>&1 | more
output.c: In function ‘indicate_special’:
output.c:778:1: internal compiler error: in set_value_range, at tree-vrp.c:367
0xed2af0 set_value_range
	../../trunk/gcc/tree-vrp.c:367
0xed4b9c get_value_range
	../../trunk/gcc/tree-vrp.c:699
0xed4e34 vrp_valueize
	../../trunk/gcc/tree-vrp.c:7054
0x105d4bf do_valueize
	../../trunk/gcc/gimple-match-head.c:557

I'll have a go at reducing the source code file.
Comment 1 David Binderman 2016-10-26 21:37:42 UTC
After reduction.

a;
static fn1(c) unsigned char c;
{
  if (a)
    fn2(c);
  fn1('#');
}
fn3() { fn1('�'); }

The blotch character in the quotes near the end seems to have ASCII value 267.
Dunno why it's not displaying correctly.
Comment 2 David Binderman 2016-10-26 21:46:42 UTC
(In reply to David Binderman from comment #1)
> The blotch character in the quotes near the end seems to have ASCII value
> 267.
> Dunno why it's not displaying correctly.

267 is a tad high for a char that supposedly can only go to 255.
Suspect octal 267. Probably character b7, in hex.

Output from od, if that helps
Comment 3 kugan 2016-10-27 02:47:53 UTC
Looks like ipa-vrp issue. I will have a look.
Comment 4 kugan 2016-10-27 05:07:25 UTC
Created attachment 39904 [details]
untested patch

testing this patch
Comment 5 David Binderman 2016-11-05 10:27:59 UTC
(In reply to kugan from comment #4)
> Created attachment 39904 [details]
> untested patch
> 
> testing this patch

patch any good ?
Comment 6 kugan 2016-11-05 10:30:29 UTC
(In reply to David Binderman from comment #5)
> (In reply to kugan from comment #4)
> > Created attachment 39904 [details]
> > untested patch
> > 
> > testing this patch
> 
> patch any good ?

Posted at https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02309.html
waiting for Honza's approval.
Comment 7 kugan 2016-11-09 01:41:58 UTC
Author: kugan
Date: Wed Nov  9 01:41:26 2016
New Revision: 241989

URL: https://gcc.gnu.org/viewcvs?rev=241989&root=gcc&view=rev
Log:
Fix ice in set_value_range
gcc/ChangeLog:

2016-11-09  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR ipa/78121
	* ipa-cp.c (propagate_vr_accross_jump_function): Pass param type.
	Also fold constant passed as argument while computing value range.
	(propagate_constants_accross_call): Pass param type.
	* ipa-prop.c: export ipa_get_callee_param_type.
	* ipa-prop.h: export ipa_get_callee_param_type.

gcc/testsuite/ChangeLog:

2016-11-09  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR ipa/78121
	* gcc.dg/ipa/pr78121.c: New test.



Added:
    trunk/gcc/testsuite/gcc.dg/ipa/pr78121.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-cp.c
    trunk/gcc/ipa-prop.c
    trunk/gcc/ipa-prop.h
    trunk/gcc/testsuite/ChangeLog
Comment 8 Aldy Hernandez 2016-11-11 01:17:26 UTC
Fixed in mainline.
Comment 9 kugan 2016-11-14 22:53:45 UTC
*** Bug 78258 has been marked as a duplicate of this bug. ***