public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc
@ 2014-05-08 13:44 rearnsha at gcc dot gnu.org
  2014-05-08 13:56 ` [Bug middle-end/61111] " ktkachov at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2014-05-08 13:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

            Bug ID: 61111
           Summary: Infinite recursion between fold_build2_stat_loc and
                    fold_binary_loc
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rearnsha at gcc dot gnu.org
              Host: x86_64-linux
            Target: arm-eabi

Compile the following with: -O2


typedef union expr_rec expr;
expr *GenBoolAndVec(expr *aExpr, expr *bExpr, int len)
{
    int lsubop;
    lsubop = ((((len) & 15) << 4) | ((0x00000007) & 15));
}

(testcase reduced from running csibe, while trying to identify another
seg-fault).


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

* [Bug middle-end/61111] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
@ 2014-05-08 13:56 ` ktkachov at gcc dot gnu.org
  2014-05-08 14:19 ` rearnsha at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2014-05-08 13:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktkachov at gcc dot gnu.org

--- Comment #1 from ktkachov at gcc dot gnu.org ---
Looks like PR 61010. Have you tried r210066 ?


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

* [Bug middle-end/61111] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
  2014-05-08 13:56 ` [Bug middle-end/61111] " ktkachov at gcc dot gnu.org
@ 2014-05-08 14:19 ` rearnsha at gcc dot gnu.org
  2014-05-08 14:32 ` rearnsha at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2014-05-08 14:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Richi, looks very similar to pr 61010, but still present on trunk today.


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

* [Bug middle-end/61111] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
  2014-05-08 13:56 ` [Bug middle-end/61111] " ktkachov at gcc dot gnu.org
  2014-05-08 14:19 ` rearnsha at gcc dot gnu.org
@ 2014-05-08 14:32 ` rearnsha at gcc dot gnu.org
  2014-05-08 14:43 ` [Bug middle-end/61111] [4.10 regression] " rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2014-05-08 14:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

--- Comment #4 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Starts with r210113, ie the wide-int merge.  Though that may just expose the
latent problem.


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-05-08 14:32 ` rearnsha at gcc dot gnu.org
@ 2014-05-08 14:43 ` rguenth at gcc dot gnu.org
  2014-05-08 14:44 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-08 14:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
I rather suspect a merge error.  The following two need to match to not
oscillate:

          /* Minimize the number of bits set in C1, i.e. C1 := C1 & ~C2,
             unless (C1 & ~C2) | (C2 & C3) for some C3 is a mask of some
             mode which allows further optimizations.  */
          c1 &= msk;
          c2 &= msk;
          wide_int c3 = c1.and_not (c2);
          for (w = BITS_PER_UNIT; w <= width; w <<= 1)
            {
              wide_int mask = wi::mask (width - w, false,
                                        TYPE_PRECISION (type));
              if (((c1 | c2) & mask) == mask && c1.and_not (mask) == 0)
                {
                  c3 = mask;
                  break;
                }
            }

and

              /* Avoid the transform if arg1 is a mask of some
                 mode which allows further optimizations.  */
              int pop = wi::popcount (warg1);
              if (!(pop >= BITS_PER_UNIT
                    && exact_log2 (pop) != -1
                    && wi::mask (pop, false, warg1.get_precision ()) == warg1))
                return fold_build2_loc (loc, code, type, op0,
                                        wide_int_to_tree (type, masked));

where the above is from

              unsigned HOST_WIDE_INT mask
                = HOST_WIDE_INT_M1U >> (HOST_BITS_PER_WIDE_INT - w);

that doesn't match the wi::mask call which should instead use w, not
width - w as argument?

That fixes the testcase.


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-05-08 14:43 ` [Bug middle-end/61111] [4.10 regression] " rguenth at gcc dot gnu.org
@ 2014-05-08 14:44 ` rguenth at gcc dot gnu.org
  2014-05-09  2:37 ` mrs at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-08 14:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.10.0


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-05-08 14:44 ` rguenth at gcc dot gnu.org
@ 2014-05-09  2:37 ` mrs at gcc dot gnu.org
  2014-05-09 11:05 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mrs at gcc dot gnu.org @ 2014-05-09  2:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrs at gcc dot gnu.org

--- Comment #6 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> ---
Kenny is spinning a fix for this and will check it in when the bootstrap and
regression run are done.


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-05-09  2:37 ` mrs at gcc dot gnu.org
@ 2014-05-09 11:05 ` rguenth at gcc dot gnu.org
  2014-05-09 11:29 ` zadeck at naturalbridge dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-09 11:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |olegendo at gcc dot gnu.org

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 61120 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-05-09 11:05 ` rguenth at gcc dot gnu.org
@ 2014-05-09 11:29 ` zadeck at naturalbridge dot com
  2014-05-09 11:35 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zadeck at naturalbridge dot com @ 2014-05-09 11:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

Kenneth Zadeck <zadeck at naturalbridge dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zadeck at naturalbridge dot com

--- Comment #8 from Kenneth Zadeck <zadeck at naturalbridge dot com> ---
Created attachment 32767
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32767&action=edit
patch to fix.

I agree with richi that the mask should have been w bits wide.
I test the patch on x86_64 last night and it causes no harm.

ok to commit?


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-05-09 11:29 ` zadeck at naturalbridge dot com
@ 2014-05-09 11:35 ` rguenther at suse dot de
  2014-05-09 12:22 ` zadeck at gcc dot gnu.org
  2014-05-09 12:30 ` zadeck at naturalbridge dot com
  10 siblings, 0 replies; 12+ messages in thread
From: rguenther at suse dot de @ 2014-05-09 11:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 9 May 2014, zadeck at naturalbridge dot com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111
> 
> Kenneth Zadeck <zadeck at naturalbridge dot com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |zadeck at naturalbridge dot com
> 
> --- Comment #8 from Kenneth Zadeck <zadeck at naturalbridge dot com> ---
> Created attachment 32767
>   --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32767&action=edit
> patch to fix.
> 
> I agree with richi that the mask should have been w bits wide.
> I test the patch on x86_64 last night and it causes no harm.
> 
> ok to commit?

Ok.


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2014-05-09 11:35 ` rguenther at suse dot de
@ 2014-05-09 12:22 ` zadeck at gcc dot gnu.org
  2014-05-09 12:30 ` zadeck at naturalbridge dot com
  10 siblings, 0 replies; 12+ messages in thread
From: zadeck at gcc dot gnu.org @ 2014-05-09 12:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

--- Comment #10 from zadeck at gcc dot gnu.org <zadeck at gcc dot gnu.org> ---
Author: zadeck
Date: Fri May  9 12:21:23 2014
New Revision: 210274

URL: http://gcc.gnu.org/viewcvs?rev=210274&root=gcc&view=rev
Log:
2014-05-06  Kenneth Zadeck  <zadeck@naturalbridge.com>

    PR middle-end/61111
    * fold-const.c (fold_binary_loc): Changed width of mask.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c


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

* [Bug middle-end/61111] [4.10 regression] Infinite recursion between fold_build2_stat_loc and fold_binary_loc
  2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2014-05-09 12:22 ` zadeck at gcc dot gnu.org
@ 2014-05-09 12:30 ` zadeck at naturalbridge dot com
  10 siblings, 0 replies; 12+ messages in thread
From: zadeck at naturalbridge dot com @ 2014-05-09 12:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61111

Kenneth Zadeck <zadeck at naturalbridge dot com> changed:

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

--- Comment #11 from Kenneth Zadeck <zadeck at naturalbridge dot com> ---
Patch committed.


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

end of thread, other threads:[~2014-05-09 12:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08 13:44 [Bug middle-end/61111] New: Infinite recursion between fold_build2_stat_loc and fold_binary_loc rearnsha at gcc dot gnu.org
2014-05-08 13:56 ` [Bug middle-end/61111] " ktkachov at gcc dot gnu.org
2014-05-08 14:19 ` rearnsha at gcc dot gnu.org
2014-05-08 14:32 ` rearnsha at gcc dot gnu.org
2014-05-08 14:43 ` [Bug middle-end/61111] [4.10 regression] " rguenth at gcc dot gnu.org
2014-05-08 14:44 ` rguenth at gcc dot gnu.org
2014-05-09  2:37 ` mrs at gcc dot gnu.org
2014-05-09 11:05 ` rguenth at gcc dot gnu.org
2014-05-09 11:29 ` zadeck at naturalbridge dot com
2014-05-09 11:35 ` rguenther at suse dot de
2014-05-09 12:22 ` zadeck at gcc dot gnu.org
2014-05-09 12:30 ` zadeck at naturalbridge dot com

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).