public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38554]  New: ICE when compiling pamfunc.c in netpbm with -O1 enabled
@ 2008-12-17 14:40 r0bertz at gentoo dot org
  2008-12-17 14:44 ` [Bug c/38554] " r0bertz at gentoo dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: r0bertz at gentoo dot org @ 2008-12-17 14:40 UTC (permalink / raw)
  To: gcc-bugs

The version is gcc 4.4, just checked out today.

This is the output of gcc -v:
Using built-in specs.
Target: mips64el-unknown-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.4.0_pre9999/work/gcc-4.4.0-9999/configure
--prefix=/usr --bindir=/usr/mips64el-unknown-linux-gnu/gcc-bin/4.4.0-pre9999
--includedir=/usr/lib/gcc/mips64el-unknown-linux-gnu/4.4.0-pre9999/include
--datadir=/usr/share/gcc-data/mips64el-unknown-linux-gnu/4.4.0-pre9999
--mandir=/usr/share/gcc-data/mips64el-unknown-linux-gnu/4.4.0-pre9999/man
--infodir=/usr/share/gcc-data/mips64el-unknown-linux-gnu/4.4.0-pre9999/info
--with-gxx-include-dir=/usr/lib/gcc/mips64el-unknown-linux-gnu/4.4.0-pre9999/include/g++-v4
--host=mips64el-unknown-linux-gnu --build=mips64el-unknown-linux-gnu
--disable-altivec --disable-fixed-point --enable-nls --without-included-gettext
--with-system-zlib --disable-checking --disable-werror --enable-secureplt
--disable-multilib --enable-libmudflap --disable-libssp --disable-libgomp
--enable-cld --disable-libgcj --with-abi=n32 --enable-languages=c,c++
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion=
--enable-linux-futex --enable-checking
Thread model: posix
gcc version 4.4.0-pre9999 built 20081217 (Gentoo SVN ebuild) rev. 142790 () 


This is the command line to trigger the bug:
/usr/libexec/gcc/mips64el-unknown-linux-gnu/4.4.0-pre9999/cc1 -quiet -v -I. 
-Iimportinc
-I/var/tmp/portage/media-libs/netpbm-10.44.00/work/netpbm-10.44.00/editor
-DNDEBUG pamfunc.c -mel -quiet -dumpbase pamfunc.c -march=loongson2f -mabi=n32
-mllsc -mno-shared -auxbase-strip pamfunc.o -Wall -version -O1


This is the output of the above command:
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/mips64el-unknown-linux-gnu/4.4.0-pre9999/../../../../mips64el-unknown-linux-gnu/include"
ignoring duplicate directory
"/var/tmp/portage/media-libs/netpbm-10.44.00/work/netpbm-10.44.00/editor"
#include "..." search starts here:
#include <...> search starts here:
 .
 importinc
 /usr/lib/gcc/mips64el-unknown-linux-gnu/4.4.0-pre9999/include
 /usr/lib/gcc/mips64el-unknown-linux-gnu/4.4.0-pre9999/include-fixed
 /usr/include
End of search list.
GNU C () version 4.4.0-pre9999 built 20081217 (Gentoo SVN ebuild) rev. 142790
(mips64el-unknown-linux-gnu)
        compiled by GNU C version 4.4.0-pre9999 built 20081217 (Gentoo SVN
ebuild) rev. 142790, GMP version 4.2.4, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 32f534140ba4fac4738b24242daa6257
pamfunc.c: In function 'main':
pamfunc.c:317: internal compiler error: in convert_move, at expr.c:371
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.


-- 
           Summary: ICE when compiling pamfunc.c in netpbm with -O1 enabled
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: r0bertz at gentoo dot org
 GCC build triplet: mips64el-unknown-linux-gnu
  GCC host triplet: mips64el-unknown-linux-gnu
GCC target triplet: mips64el-unknown-linux-gnu


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


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

* [Bug c/38554] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
@ 2008-12-17 14:44 ` r0bertz at gentoo dot org
  2009-01-13 21:08 ` [Bug target/38554] " nemet at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: r0bertz at gentoo dot org @ 2008-12-17 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from r0bertz at gentoo dot org  2008-12-17 14:43 -------
http://www.gentoo-cn.org/~zhangle/pamfunc.i

I can't upload the attachment.
So I have uploaded the preprocessed file to my server. Please get it at the
above link.


-- 


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


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

* [Bug target/38554] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
  2008-12-17 14:44 ` [Bug c/38554] " r0bertz at gentoo dot org
@ 2009-01-13 21:08 ` nemet at gcc dot gnu dot org
  2009-01-13 22:50 ` [Bug target/38554] [4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: nemet at gcc dot gnu dot org @ 2009-01-13 21:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from nemet at gcc dot gnu dot org  2009-01-13 21:08 -------
Here is the testcase simplified with delta.  It's reproducible even with a
mipsisa64r2-elfobai compiler with -O1.

I don't think the bug is MIPS-specific.  Inside expand_shift, amount which is:

(int) VIEW_CONVERT_EXPR<const unsigned int>(D.4496)

gets expanded into an SF pseudo.  Shifting by a floating-point value might be
confusing the rest of the function.

typedef unsigned long sample;
struct pam
{
  sample maxval;
};
typedef sample *tuple;
enum function
{
  FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR,
    FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT
};
struct cmdlineInfo
{
  enum function function;
  union
  {
    float divisor;
    unsigned int shiftCount;
  }
  u;
};
applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam,
               struct pam const outpam, tuple * const inputRow,
               tuple * const outputRow)
{
  float const oneOverDivisor = 1 / cmdline.u.divisor;
  int col;
  {
    int plane;
    {
      sample const inSample = inputRow[col][plane];
      sample outSample;
      switch (cmdline.function)
        {
        case FN_DIVIDE:
          outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5));
          break;
        case FN_SHIFTLEFT:
          outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval;
        }
      outputRow[col][plane] =
        ((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample));
    }
  }
}


-- 


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


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

* [Bug target/38554] [4.4 Regression] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
  2008-12-17 14:44 ` [Bug c/38554] " r0bertz at gentoo dot org
  2009-01-13 21:08 ` [Bug target/38554] " nemet at gcc dot gnu dot org
@ 2009-01-13 22:50 ` rguenth at gcc dot gnu dot org
  2009-01-14 21:49 ` nemet at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-13 22:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-01-13 22:49 -------
i?86 expands it to

(insn 39 38 40 t.i:39 (set (reg:SI 85)
        (subreg:SI (reg:SF 65 [ D.1268 ]) 0)) -1 (nil))

(insn 40 39 41 t.i:39 (set (reg:QI 84)
        (subreg:QI (reg:SI 85) 0)) -1 (nil))

(insn 41 40 42 t.i:39 (parallel [
            (set (reg:SI 83)
                (ashift:SI (reg/v:SI 60 [ inSample ])
                    (reg:QI 84)))
            (clobber (reg:CC 17 flags))
        ]) -1 (nil))

which looks good.  How does the mips variant look like?

The trees are new with 4.4 as we create V_C_Es for available union data.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
            Summary|ICE when compiling pamfunc.c|[4.4 Regression] ICE when
                   |in netpbm with -O1 enabled  |compiling pamfunc.c in
                   |                            |netpbm with -O1 enabled
   Target Milestone|---                         |4.4.0


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


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

* [Bug target/38554] [4.4 Regression] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
                   ` (2 preceding siblings ...)
  2009-01-13 22:50 ` [Bug target/38554] [4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2009-01-14 21:49 ` nemet at gcc dot gnu dot org
  2009-01-14 21:50 ` nemet at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: nemet at gcc dot gnu dot org @ 2009-01-14 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from nemet at gcc dot gnu dot org  2009-01-14 21:48 -------
It only happens on SHIFT_COUNT_TRUNCATED targets (i.e. mips but not x86).

I will do some more digging on the history of the SHIFT_COUNT_TRUNCATED code
here but this patch fixes the ICE:

Index: expmed.c 
=================================================================== 
--- expmed.c    (revision 143286) 
+++ expmed.c    (working copy) 
@@ -2119,21 +2119,22 @@ expand_shift (enum tree_code code, enum  
      on all machines.  */ 

   if (SHIFT_COUNT_TRUNCATED) 
     { 
       if (GET_CODE (op1) == CONST_INT 
          && ((unsigned HOST_WIDE_INT) INTVAL (op1) >= 
              (unsigned HOST_WIDE_INT) GET_MODE_BITSIZE (mode))) 
        op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1) 
                       % GET_MODE_BITSIZE (mode)); 
       else if (GET_CODE (op1) == SUBREG 
-              && subreg_lowpart_p (op1)) 
+              && subreg_lowpart_p (op1) 
+              && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1)))) 
        op1 = SUBREG_REG (op1); 
     } 

   if (op1 == const0_rtx) 
     return shifted; 

   /* Check whether its cheaper to implement a left shift by a constant 
      bit count by a sequence of additions.  */ 
   if (code == LSHIFT_EXPR 
       && GET_CODE (op1) == CONST_INT 



-- 


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


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

* [Bug target/38554] [4.4 Regression] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
                   ` (3 preceding siblings ...)
  2009-01-14 21:49 ` nemet at gcc dot gnu dot org
@ 2009-01-14 21:50 ` nemet at gcc dot gnu dot org
  2009-01-15 15:54 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: nemet at gcc dot gnu dot org @ 2009-01-14 21:50 UTC (permalink / raw)
  To: gcc-bugs



-- 

nemet at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nemet at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-14 21:49:53
               date|                            |


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


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

* [Bug target/38554] [4.4 Regression] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
                   ` (4 preceding siblings ...)
  2009-01-14 21:50 ` nemet at gcc dot gnu dot org
@ 2009-01-15 15:54 ` rguenth at gcc dot gnu dot org
  2009-01-16 18:57 ` nemet at gcc dot gnu dot org
  2009-01-16 18:57 ` nemet at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-15 15:54 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug target/38554] [4.4 Regression] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
                   ` (6 preceding siblings ...)
  2009-01-16 18:57 ` nemet at gcc dot gnu dot org
@ 2009-01-16 18:57 ` nemet at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: nemet at gcc dot gnu dot org @ 2009-01-16 18:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from nemet at gcc dot gnu dot org  2009-01-16 18:57 -------
Fixed.


-- 

nemet at gcc dot gnu dot org changed:

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


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


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

* [Bug target/38554] [4.4 Regression] ICE when compiling pamfunc.c in netpbm with -O1 enabled
  2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
                   ` (5 preceding siblings ...)
  2009-01-15 15:54 ` rguenth at gcc dot gnu dot org
@ 2009-01-16 18:57 ` nemet at gcc dot gnu dot org
  2009-01-16 18:57 ` nemet at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: nemet at gcc dot gnu dot org @ 2009-01-16 18:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from nemet at gcc dot gnu dot org  2009-01-16 18:57 -------
Subject: Bug 38554

Author: nemet
Date: Fri Jan 16 18:56:47 2009
New Revision: 143440

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143440
Log:
        PR target/38554
        * expmed.c (expand_shift): With SHIFT_COUNT_TRUNCATED, don't lift
        the subreg from a lowpart subreg if it is also casting the value.

testsuite/
        PR target/38554
        * gcc.c-torture/compile/pr38554.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr38554.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expmed.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2009-01-16 18:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-17 14:40 [Bug c/38554] New: ICE when compiling pamfunc.c in netpbm with -O1 enabled r0bertz at gentoo dot org
2008-12-17 14:44 ` [Bug c/38554] " r0bertz at gentoo dot org
2009-01-13 21:08 ` [Bug target/38554] " nemet at gcc dot gnu dot org
2009-01-13 22:50 ` [Bug target/38554] [4.4 Regression] " rguenth at gcc dot gnu dot org
2009-01-14 21:49 ` nemet at gcc dot gnu dot org
2009-01-14 21:50 ` nemet at gcc dot gnu dot org
2009-01-15 15:54 ` rguenth at gcc dot gnu dot org
2009-01-16 18:57 ` nemet at gcc dot gnu dot org
2009-01-16 18:57 ` nemet at gcc dot gnu dot 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).