public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable
@ 2014-05-28 22:09 ian at airs dot com
  2014-05-28 22:10 ` [Bug tree-optimization/61346] " ian at airs dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ian at airs dot com @ 2014-05-28 22:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61346

            Bug ID: 61346
           Summary: VRP chooses bad bounds for variable
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at airs dot com
                CC: cmang at google dot com

The attached file, which is a Go test case converted to C code, should compile
and run without error.  It works with GCC 4.6.3 and GCC 4.9 branch with and
without optimization.  It works with mainline with -O0 and -O1.  It fails with
mainline with -O2.

I think the problem is in the VRP pass.  I see this in 067.vrp1:

i_3: [data$len_58, 9223372036854775806]  EQUIVALENCES: { i_65 } (1 elements)

This is flat out wrong, as inspection of 066.mergephi2 shows that the ideally
correct range of i_3 should be something like [0, data$len_58].  What's
particularly odd is that i_3 is even set to i_1, and the range of i_1 is
VARYING.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/61346] VRP chooses bad bounds for variable
  2014-05-28 22:09 [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable ian at airs dot com
@ 2014-05-28 22:10 ` ian at airs dot com
  2014-05-28 22:12 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ian at airs dot com @ 2014-05-28 22:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61346

--- Comment #1 from Ian Lance Taylor <ian at airs dot com> ---
Created attachment 32872
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32872&action=edit
test case


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/61346] VRP chooses bad bounds for variable
  2014-05-28 22:09 [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable ian at airs dot com
  2014-05-28 22:10 ` [Bug tree-optimization/61346] " ian at airs dot com
@ 2014-05-28 22:12 ` pinskia at gcc dot gnu.org
  2014-05-28 22:16 ` ian at airs dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-05-28 22:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61346

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Was this before or after revision 211012?  There was a bug in VRP which was
also exposed by Fortran bounds checking: bug 61335.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/61346] VRP chooses bad bounds for variable
  2014-05-28 22:09 [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable ian at airs dot com
  2014-05-28 22:10 ` [Bug tree-optimization/61346] " ian at airs dot com
  2014-05-28 22:12 ` pinskia at gcc dot gnu.org
@ 2014-05-28 22:16 ` ian at airs dot com
  2014-05-28 22:17 ` ian at airs dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ian at airs dot com @ 2014-05-28 22:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61346

--- Comment #3 from Ian Lance Taylor <ian at airs dot com> ---
Reverting this patch to tree-vrp.c fixes the problem:

2014-05-27  Richard Biener  <rguenther@suse.de>

    * tree-vrp.c (vrp_evaluate_conditional_warnv_with_ops_using_ranges):
    Try using literal operands when comparing value-ranges failed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/61346] VRP chooses bad bounds for variable
  2014-05-28 22:09 [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable ian at airs dot com
                   ` (2 preceding siblings ...)
  2014-05-28 22:16 ` ian at airs dot com
@ 2014-05-28 22:17 ` ian at airs dot com
  2014-05-28 22:25 ` ian at airs dot com
  2014-06-02  8:08 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ian at airs dot com @ 2014-05-28 22:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61346

--- Comment #4 from Ian Lance Taylor <ian at airs dot com> ---
This was before 211012.  It may be fixed.  I will check.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/61346] VRP chooses bad bounds for variable
  2014-05-28 22:09 [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable ian at airs dot com
                   ` (3 preceding siblings ...)
  2014-05-28 22:17 ` ian at airs dot com
@ 2014-05-28 22:25 ` ian at airs dot com
  2014-06-02  8:08 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ian at airs dot com @ 2014-05-28 22:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61346

Ian Lance Taylor <ian at airs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Ian Lance Taylor <ian at airs dot com> ---
Yes, it seems to be fixed.  Thanks for the pointer.

Richard B, I'll let you decide whether it's worth adding this C test case to
the testsuite.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/61346] VRP chooses bad bounds for variable
  2014-05-28 22:09 [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable ian at airs dot com
                   ` (4 preceding siblings ...)
  2014-05-28 22:25 ` ian at airs dot com
@ 2014-06-02  8:08 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-02  8:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61346

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Jun  2 08:07:23 2014
New Revision: 211128

URL: http://gcc.gnu.org/viewcvs?rev=211128&root=gcc&view=rev
Log:
2014-06-02  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/61346
    * gcc.dg/torture/pr61346.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr61346.c
Modified:
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-02  8:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-28 22:09 [Bug tree-optimization/61346] New: VRP chooses bad bounds for variable ian at airs dot com
2014-05-28 22:10 ` [Bug tree-optimization/61346] " ian at airs dot com
2014-05-28 22:12 ` pinskia at gcc dot gnu.org
2014-05-28 22:16 ` ian at airs dot com
2014-05-28 22:17 ` ian at airs dot com
2014-05-28 22:25 ` ian at airs dot com
2014-06-02  8:08 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).