Bug 61033 - [4.9 Regression] Infinite loop in variable tracking
Summary: [4.9 Regression] Infinite loop in variable tracking
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.9.0
: P2 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: compile-time-hog
: 62013 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-05-02 04:40 UTC by Michael Collison
Modified: 2016-08-03 10:52 UTC (History)
3 users (show)

See Also:
Host:
Target: arm-linux-gnueabi, arm-none-eabi
Build:
Known to work: 4.7.4, 5.0
Known to fail: 4.8.3, 4.9.1
Last reconfirmed: 2014-05-02 00:00:00


Attachments
Preprocssed file to reproduce bug (227.42 KB, application/x-gzip)
2014-05-02 04:40 UTC, Michael Collison
Details
Reduced test case (577 bytes, text/x-c++src)
2014-08-04 18:07 UTC, cbaylis
Details
C++ source code (85.64 KB, text/x-c++src)
2014-08-19 16:25 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Collison 2014-05-02 04:40:04 UTC
Created attachment 32722 [details]
Preprocssed file to reproduce bug

Data flow analysis in variable tracking does not converge and causes an infinite loop with the attached file and following compile options:

./cc1plus -quiet -fpreprocessed qmltextgenerator.ii -dumpbase qmltextgenerator.ii -march=armv4t -mfloat-abi=soft -mtls-dialect=gnu -auxbase-strip x.o -g -O2 -Wformat=1 -Werror=format-security -Wall -Wextra -version -fstack-protector -fvisibility=hidden -fvisibility-inlines-hidden -fPIC --param ssp-buffer-size=4 -o qmltextgenerator.s

GCC configured with --target=arm-linux-gnueabi
Comment 1 ktkachov 2014-05-02 08:17:39 UTC
Confirmed with arm-none-eabi as well.
Comment 2 Maxim Kuvyrkov 2014-05-07 01:31:55 UTC
Assigned to myself as Michael does not have a GCC developer account yet.  Michael is the one working on this bug.
Comment 3 ktkachov 2014-08-04 15:42:04 UTC
*** Bug 62013 has been marked as a duplicate of this bug. ***
Comment 4 ktkachov 2014-08-04 15:45:17 UTC
Filling in some fields, this still fails on the 4.8 and 4.9 branches but works on trunk.
Comment 5 cbaylis 2014-08-04 18:07:47 UTC
Created attachment 33244 [details]
Reduced test case


$ arm-unknown-linux-gnueabihf-gcc -S -O2 -g reduced1.cpp
Comment 6 cbaylis 2014-08-04 18:43:39 UTC
git bisect points to r211625 as the revision which fixes/hides this bug on trunk.

2014-06-13  Richard Biener  <rguenther@suse.de>

        * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
        Rewrite to propagate the VN result into all uses where
        possible and to remove stmts becoming dead because of that.
        (eliminate): Generalize stmt removal handling, remove in
        reverse dominator order to support proper debug stmt
        generation.  Update stmts before removing stmts.
        * tree-ssa-propagate.c (propagate_tree_value): Remove
        bogus assert.
Comment 7 Michael Collison 2014-08-04 18:55:00 UTC
Charlie,

I still feel that the var tracking pass should be able to protect itself 
from an infinite loop.

On 8/4/2014 11:43 AM, cbaylis at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61033
>
> --- Comment #6 from cbaylis at gcc dot gnu.org ---
>
> git bisect points to r211625 as the revision which fixes/hides this bug on
> trunk.
>
> 2014-06-13  Richard Biener  <rguenther@suse.de>
>
>          * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
>          Rewrite to propagate the VN result into all uses where
>          possible and to remove stmts becoming dead because of that.
>          (eliminate): Generalize stmt removal handling, remove in
>          reverse dominator order to support proper debug stmt
>          generation.  Update stmts before removing stmts.
>          * tree-ssa-propagate.c (propagate_tree_value): Remove
>          bogus assert.
>
Comment 8 David Binderman 2014-08-19 16:25:30 UTC
Created attachment 33361 [details]
C++ source code
Comment 9 David Binderman 2014-08-19 16:33:26 UTC
(In reply to David Binderman from comment #8)
> Created attachment 33361 [details]
> C++ source code

Please ignore this attachment. It is for a different bug.
Comment 10 Maxim Kuvyrkov 2014-11-05 12:54:56 UTC
Michael,

What is the status of this bug?

Thanks.
Comment 11 Jakub Jelinek 2014-12-19 13:30:22 UTC
GCC 4.8.4 has been released.
Comment 12 Michael Collison 2015-05-21 02:09:54 UTC
GCC is looping infinitely in attempting to solve a data flow problem in vt_find_locations. My working theory is that compute_bb_dataflow is incorrectly asserting some value has changed. I have reduced my case to a candidate set of basic blocks and a (candiate) RTL location this is continually removed/added. The rtl location is:

dataflow difference found: removal of:
 name: D#255
   offset 0
     (mem/f/c:SI (value/u:SI 106:3955 @0x22cb2f8/0x23424a0) [3 result.d+0 S4 A32])


I understand that the argument to 'VALUE" is a cselib_val_struct but I don't know how to map this back to a insn that is causing the problem. Any thoughts on how I might debug thus further?
Comment 13 Richard Biener 2015-06-23 08:19:28 UTC
The gcc-4_8-branch is being closed, re-targeting regressions to 4.9.3.
Comment 14 Jakub Jelinek 2015-06-26 19:55:23 UTC
GCC 4.9.3 has been released.
Comment 15 Maxim Kuvyrkov 2016-02-24 16:42:24 UTC
Author: mkuvyrkov
Date: Wed Feb 24 16:41:52 2016
New Revision: 233675

URL: https://gcc.gnu.org/viewcvs?rev=233675&root=gcc&view=rev
Log:
	PR debug/61033
	* g++.dg/pr61033.C: Add a regression testcase for PR debug/61033.

Added:
    trunk/gcc/testsuite/g++.dg/pr61033.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 16 Richard Biener 2016-08-03 10:52:29 UTC
Fixed in GCC 5+