Fix handling of very long asm statements in inliner
authorAndi Kleen <ak@linux.intel.com>
Sun, 8 Sep 2013 23:41:38 +0000 (23:41 +0000)
committerAndi Kleen <ak@gcc.gnu.org>
Sun, 8 Sep 2013 23:41:38 +0000 (23:41 +0000)
commitcc4029ee7987de113a4e55a243818dd754245345
tree8ffb6df62f9e66b086cef2af05cda842981860ed
parent41e96dc8f0a700a440c7bb87fbbd1cc70271ff15
Fix handling of very long asm statements in inliner

An auto generated program with a 6.4mio line asm statement gave
with 4.7 and 4.8:

xxx.c:6400017:1: internal compiler error: in account_size_time, at
ipa-inline-analysis.c:601

The problem is that the inliner counts the number of lines in the asm
statement and multiplies that with a weight. With the weight this
overflows 32bit signed int, and triggers an assert for negative time.

Fix this by limiting the number of lines to 1000 for asm cost
estimation. The RTL backend also does similar multiplications for
jump shortening. I haven't tried to address this, but presumably
it's less likely to result in a failure.

gcc/:
2013-09-08  Andi Kleen  <ak@linux.intel.com>

* tree-inline.c (estimate_num_insns): Limit asm cost to 1000.

From-SVN: r202374
gcc/ChangeLog
gcc/tree-inline.c