public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
@ 2012-11-11 19:57 dougmencken at gmail dot com
  2012-11-11 19:58 ` [Bug c/55273] " dougmencken at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dougmencken at gmail dot com @ 2012-11-11 19:57 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55273
           Summary: [4.8.0 regression] ICE in iv_number_of_iterations, at
                    loop-iv.c:2819
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dougmencken@gmail.com


Created attachment 28658
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28658
Preprocessed source

I tried to build GDB v7.5 with gcc version 4.8.0 20121021 (experimental) (GCC),
and got the following:

powerpc-gnu-linux-uclibc-gcc -c -O3 -O3    -I. -I. -I./../common
-I./../regformats -I./../../include -I./../gnulib/import
-Ibuild-gnulib-gdbserver/import -Wall -Wdeclaration-after-statement
-Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts  linux-low.c
-DUSE_THREAD_DB
linux-low.c: In function 'my_waitpid':
linux-low.c:430:1: internal compiler error: in iv_number_of_iterations, at
loop-iv.c:2819
 }
 ^
mmap: Invalid argument
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[4]: *** [linux-low.o] Error 1
make[4]: Leaving directory `/root/build-farm/gdb-v7.5.builddir/gdb/gdbserver'
make[3]: *** [subdir_do] Error 1
make[3]: Leaving directory `/root/build-farm/gdb-v7.5.builddir/gdb'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/build-farm/gdb-v7.5.builddir/gdb'
make[1]: *** [all-gdb] Error 2
make[1]: Leaving directory `/root/build-farm/gdb-v7.5.builddir'
make: *** [all] Error 2

Attaching preprocessed source, as well as original C source, and also assembly
file (gdb/gdbserver/linux-low.s).


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

* [Bug c/55273] [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
@ 2012-11-11 19:58 ` dougmencken at gmail dot com
  2012-11-11 19:58 ` dougmencken at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dougmencken at gmail dot com @ 2012-11-11 19:58 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Douglas Mencken <dougmencken at gmail dot com> 2012-11-11 19:58:14 UTC ---
Created attachment 28659
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28659
Original C source


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

* [Bug c/55273] [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
  2012-11-11 19:58 ` [Bug c/55273] " dougmencken at gmail dot com
@ 2012-11-11 19:58 ` dougmencken at gmail dot com
  2012-11-25 15:52 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dougmencken at gmail dot com @ 2012-11-11 19:58 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Douglas Mencken <dougmencken at gmail dot com> 2012-11-11 19:58:43 UTC ---
Created attachment 28660
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28660
Assembly source


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

* [Bug c/55273] [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
  2012-11-11 19:58 ` [Bug c/55273] " dougmencken at gmail dot com
  2012-11-11 19:58 ` dougmencken at gmail dot com
@ 2012-11-25 15:52 ` rguenth at gcc dot gnu.org
  2012-12-07  9:43 ` [Bug rtl-optimization/55273] [4.8 Regression] " rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-11-25 15:52 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.0


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (2 preceding siblings ...)
  2012-11-25 15:52 ` rguenth at gcc dot gnu.org
@ 2012-12-07  9:43 ` rguenth at gcc dot gnu.org
  2012-12-07 10:07 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-07  9:43 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-12-07
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |iant at google dot com
          Component|c                           |rtl-optimization
            Summary|[4.8.0 regression] ICE in   |[4.8 Regression] ICE in
                   |iv_number_of_iterations, at |iv_number_of_iterations, at
                   |loop-iv.c:2819              |loop-iv.c:2819
     Ever Confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-07 09:42:19 UTC ---
Ian, the mmap: Invalid argument looks like from libbacktrace - you might want
to investigate that (uclibc host).

Confirmed with a cross cc1.

#1  0x0000000000956b51 in iv_number_of_iterations (loop=0x7ffff6b37dd0, 
    insn=0x7ffff5eed9d8, condition=0x7ffff5ef3db0, desc=0x7fffffffd9d0)
    at /space/rguenther/src/svn/trunk/gcc/loop-iv.c:2819
2819          gcc_assert (max);
(gdb) l
2814                                false, true);
2815        }
2816      else
2817        {
2818          max = determine_max_iter (loop, desc, old_niter);
2819          gcc_assert (max);
2820          if (!desc->infinite
2821              && !desc->assumptions)
2822            record_niter_bound (loop, double_int::from_uhwi (max),
2823                                false, true);
(gdb) p max
$1 = 0

Honza?

Reducing.


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (3 preceding siblings ...)
  2012-12-07  9:43 ` [Bug rtl-optimization/55273] [4.8 Regression] " rguenth at gcc dot gnu.org
@ 2012-12-07 10:07 ` rguenth at gcc dot gnu.org
  2012-12-07 11:02 ` ian at airs dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-07 10:07 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-07 10:06:56 UTC ---
Reduced testcase:

extern int debug_threads;
extern void sigsuspend (void);
void my_waitpid (int flags, int wnohang)
{
  while (1)
    {
      if (flags & 0x80000000)
        {
          if (wnohang)
            break;
          if (debug_threads)
            __builtin_puts ("blocking\n");
          sigsuspend ();
        }
      flags ^= 0x80000000;
    }
}


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (4 preceding siblings ...)
  2012-12-07 10:07 ` rguenth at gcc dot gnu.org
@ 2012-12-07 11:02 ` ian at airs dot com
  2012-12-07 11:40 ` steven at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ian at airs dot com @ 2012-12-07 11:02 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com

--- Comment #5 from Ian Lance Taylor <ian at airs dot com> 2012-12-07 11:02:05 UTC ---
Douglas, can you help investigate the mmap error?

Run "gcc -v".  It will show a line executing the program cc1.  Run gdb on cc1
with the exact same arguments.  It will presumably fail in the same way.  Set a
breakpoint on bt_err_callback in diagnostic.c.  It should be called with the
mmap error.  Go up on the stack frame, see which mmap call failed, and see what
arguments were passed to mmap.

Thanks!


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (5 preceding siblings ...)
  2012-12-07 11:02 ` ian at airs dot com
@ 2012-12-07 11:40 ` steven at gcc dot gnu.org
  2013-01-04 22:38 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu.org @ 2012-12-07 11:40 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Steven Bosscher <steven at gcc dot gnu.org> 2012-12-07 11:40:16 UTC ---
(In reply to comment #5)
> Douglas, can you help investigate the mmap error?
> 
> Run "gcc -v".  It will show a line executing the program cc1.  Run gdb
> on cc1 with the exact same arguments.  It will presumably fail in the
> same way.

Or run gcc with your usual command line, but add "-wrapper gdb,--args".
This will automatically call cc1 via gdb.


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (6 preceding siblings ...)
  2012-12-07 11:40 ` steven at gcc dot gnu.org
@ 2013-01-04 22:38 ` hubicka at gcc dot gnu.org
  2013-01-16 13:17 ` hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hubicka at gcc dot gnu.org @ 2013-01-04 22:38 UTC (permalink / raw)
  To: gcc-bugs


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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |hubicka at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> 2013-01-04 22:37:59 UTC ---
Mine.  It seems I got overzealous with the assert here and it is just safe to
remove (the usual off by one thinko wrt number of iterations).


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (7 preceding siblings ...)
  2013-01-04 22:38 ` hubicka at gcc dot gnu.org
@ 2013-01-16 13:17 ` hubicka at gcc dot gnu.org
  2013-01-17 16:37 ` jakub at gcc dot gnu.org
  2013-01-17 16:39 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: hubicka at gcc dot gnu.org @ 2013-01-16 13:17 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> 2013-01-16 13:17:30 UTC ---
OK, the problem is that the "induction" variable here is not normal induction
variable but handed by xor.

PPC target seems to be only that translates  (flags & 0x80000000)
into 
(insn 47 45 54 11 (set (reg/v:SI 125 [ flags ])
        (plus:SI (reg/v:SI 125 [ flags ])
            (const_int -2147483648 [0xffffffff80000000]))) t.c:15 64
{*addsi3_internal1}
     (nil))
so turning it into normal IV var.

This makes loop-iv to get what tree level IV doesn't.  We could make tree level
IV to also handle this XOR as plus, but that is more an enhancement.
I am testing the following patch.

Index: loop-iv.c
===================================================================
--- loop-iv.c   (revision 195144)
+++ loop-iv.c   (working copy)
@@ -2819,7 +2819,8 @@ iv_number_of_iterations (struct loop *lo
   else
     {
       max = determine_max_iter (loop, desc, old_niter);
-      gcc_assert (max);
+      if (!max)
+       goto zero_iter_simplify;
       if (!desc->infinite
          && !desc->assumptions)
        record_niter_bound (loop, double_int::from_uhwi (max),


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (8 preceding siblings ...)
  2013-01-16 13:17 ` hubicka at gcc dot gnu.org
@ 2013-01-17 16:37 ` jakub at gcc dot gnu.org
  2013-01-17 16:39 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-17 16:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-17 16:36:53 UTC ---
Author: jakub
Date: Thu Jan 17 16:36:43 2013
New Revision: 195275

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195275
Log:
    PR tree-optimizatoin/55273
    * gcc.c-torture/compile/pr55273.c: New testcase.

    * loop-iv.c (iv_number_of_iterations): Consider zero iteration case.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr55273.c
      - copied unchanged from r195274,
trunk/gcc/testsuite/gcc.c-torture/compile/pr51083.c
Removed:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr51083.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog


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

* [Bug rtl-optimization/55273] [4.8 Regression] ICE in iv_number_of_iterations, at loop-iv.c:2819
  2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
                   ` (9 preceding siblings ...)
  2013-01-17 16:37 ` jakub at gcc dot gnu.org
@ 2013-01-17 16:39 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-17 16:39 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-17 16:38:28 UTC ---
Author: hubicka
Date: Thu Jan 17 16:27:23 2013
New Revision: 195274

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195274
Log:

    PR tree-optimizatoin/51083

    * gcc.c-torture/compile/pr51083.c: New testcase.

    * loop-iv.c (iv_number_of_iterations): Consider zero iteration case.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr51083.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/loop-iv.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2013-01-17 16:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-11 19:57 [Bug c/55273] New: [4.8.0 regression] ICE in iv_number_of_iterations, at loop-iv.c:2819 dougmencken at gmail dot com
2012-11-11 19:58 ` [Bug c/55273] " dougmencken at gmail dot com
2012-11-11 19:58 ` dougmencken at gmail dot com
2012-11-25 15:52 ` rguenth at gcc dot gnu.org
2012-12-07  9:43 ` [Bug rtl-optimization/55273] [4.8 Regression] " rguenth at gcc dot gnu.org
2012-12-07 10:07 ` rguenth at gcc dot gnu.org
2012-12-07 11:02 ` ian at airs dot com
2012-12-07 11:40 ` steven at gcc dot gnu.org
2013-01-04 22:38 ` hubicka at gcc dot gnu.org
2013-01-16 13:17 ` hubicka at gcc dot gnu.org
2013-01-17 16:37 ` jakub at gcc dot gnu.org
2013-01-17 16:39 ` jakub 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).