Bug 37048 - [4.4 Regression] Revision 138835 breaks bootstrap
Summary: [4.4 Regression] Revision 138835 breaks bootstrap
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 blocker
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code
: 37045 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-07 13:07 UTC by H.J. Lu
Modified: 2008-08-10 20:20 UTC (History)
4 users (show)

See Also:
Host:
Target: i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2008-08-07 13:07:11 UTC
Revision 138835 breaks bootstrap on Linux/x86-64:

[hjl@gnu-33 zlib]$ /export/gnu/import/svn/gcc-test/bld/./prev-gcc/xgcc -B/export/gnu/import/svn/gcc-test/bld/./prev-gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"zlib\" -DVERSION=\"1.1.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DHAVE_MEMCPY=1 -DHAVE_STRERROR=1 -DHAVE_UNISTD_H=1  -I. -I../../src/zlib     -g -O2 -c -o libz_a-gzio.o `test -f 'gzio.c' || echo '../../src/zlib/'`gzio.c
../../src/zlib/gzio.c: In function âgzseekâ:
../../src/zlib/gzio.c:852: error: unrecognizable insn:
(insn 53 248 54 15 ../../src/zlib/gzio.c:792 (parallel [
            (set (mem:QI (reg:DI 77) [0 S1 A8])
                (subreg:QI (reg:SI 79) 0))
            (set (reg:DI 77)
                (plus:DI (reg:DI 77)
                    (const_int 1 [0x1])))
        ]) -1 (nil))
../../src/zlib/gzio.c:852: internal compiler error: in extract_insn, at recog.c:1988
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-33 zlib]$

Gcc was configured with  --enable-checking=assert --enable-clocale=gnu --with-sy
stem-zlib --enable-shared --with-demangler-in-ld.
Comment 1 H.J. Lu 2008-08-07 13:20:54 UTC
*** Bug 37045 has been marked as a duplicate of this bug. ***
Comment 2 H.J. Lu 2008-08-07 13:21:21 UTC
It also happens on Linux/ia32.
Comment 3 H.J. Lu 2008-08-07 13:47:46 UTC
[hjl@gnu-3 prev-gcc]$ cat ../zlib/x.c
typedef struct gz_stream {
    char *inbuf;
    long offset;
} gz_stream;


void *malloc(__SIZE_TYPE__ size);

long
foo (void * file, long offset)
{
    gz_stream *s = (gz_stream*)file;
        if (s->inbuf == 0) {
            s->inbuf = malloc (2000);
            if (s->inbuf == 0) return -1L;
            __builtin_memset (s->inbuf, 0, 2000);
        }
        while (offset > 0)  {
          unsigned int size = 2000;
            offset -= size;
        }
    return s->offset;
}
[hjl@gnu-3 prev-gcc]$ ./xgcc -B./ -O2 -S ../zlib/x.c
../zlib/x.c: In function âfooâ:
../zlib/x.c:23: error: unrecognizable insn:
(insn 33 84 34 8 ../zlib/x.c:16 (parallel [
            (set (mem:QI (reg:SI 67) [0 S1 A8])
                (subreg:QI (reg:SI 69) 0))
            (set (reg:SI 67)
                (plus:SI (reg:SI 67)
                    (const_int 1 [0x1])))
        ]) -1 (nil))
../zlib/x.c:23: internal compiler error: in extract_insn, at recog.c:1988
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-3 prev-gcc]$
Comment 4 Jan Hubicka 2008-08-07 14:30:52 UTC
Subject: Re:  [4.4 Regression] Revision 138835 breaks bootstrap

Hi,
thanks for testcase, for some reason it does not reproduce on our
testing setup, probably due to ancient glibc that still has
memcpy/memset inlines.

This patch should fix it, I am testing it right now but I am not sure I
will be able to commit before tomorro wunforutnately.
The problem is that we now use single stringops on optimize_size
regions, but the patterns are disabled. It is not problem to enable
them; we never produce them directly, only via the stringop expanders.
(at least I am convinced combine won't produce this)

Honza

	* i386.md (single stringop patterns): Enable unconditionally.
Index: config/i386/i386.md
===================================================================
*** config/i386/i386.md	(revision 138835)
--- config/i386/i386.md	(working copy)
***************
*** 18652,18658 ****
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 8)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "movsq"
    [(set_attr "type" "str")
     (set_attr "mode" "DI")
--- 18652,18658 ----
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 8)))]
!   "TARGET_64BIT"
    "movsq"
    [(set_attr "type" "str")
     (set_attr "mode" "DI")
***************
*** 18667,18673 ****
     (set (match_operand:SI 1 "register_operand" "=S")
  	(plus:SI (match_dup 3)
  		 (const_int 4)))]
!   "!TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "movs{l|d}"
    [(set_attr "type" "str")
     (set_attr "mode" "SI")
--- 18667,18673 ----
     (set (match_operand:SI 1 "register_operand" "=S")
  	(plus:SI (match_dup 3)
  		 (const_int 4)))]
!   "!TARGET_64BIT"
    "movs{l|d}"
    [(set_attr "type" "str")
     (set_attr "mode" "SI")
***************
*** 18682,18688 ****
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 4)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "movs{l|d}"
    [(set_attr "type" "str")
     (set_attr "mode" "SI")
--- 18682,18688 ----
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 4)))]
!   "TARGET_64BIT"
    "movs{l|d}"
    [(set_attr "type" "str")
     (set_attr "mode" "SI")
***************
*** 18697,18703 ****
     (set (match_operand:SI 1 "register_operand" "=S")
  	(plus:SI (match_dup 3)
  		 (const_int 2)))]
!   "!TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "movsw"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
--- 18697,18703 ----
     (set (match_operand:SI 1 "register_operand" "=S")
  	(plus:SI (match_dup 3)
  		 (const_int 2)))]
!   "!TARGET_64BIT"
    "movsw"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
***************
*** 18712,18718 ****
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 2)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "movsw"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
--- 18712,18718 ----
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 2)))]
!   "TARGET_64BIT"
    "movsw"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
***************
*** 18727,18733 ****
     (set (match_operand:SI 1 "register_operand" "=S")
  	(plus:SI (match_dup 3)
  		 (const_int 1)))]
!   "!TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "movsb"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
--- 18727,18733 ----
     (set (match_operand:SI 1 "register_operand" "=S")
  	(plus:SI (match_dup 3)
  		 (const_int 1)))]
!   "!TARGET_64BIT"
    "movsb"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
***************
*** 18742,18748 ****
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 1)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "movsb"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
--- 18742,18748 ----
     (set (match_operand:DI 1 "register_operand" "=S")
  	(plus:DI (match_dup 3)
  		 (const_int 1)))]
!   "TARGET_64BIT"
    "movsb"
    [(set_attr "type" "str")
     (set_attr "memory" "both")
***************
*** 18917,18923 ****
  		   (match_operand 2 "register_operand" ""))
  	      (set (match_operand 0 "register_operand" "")
  		   (match_operand 3 "" ""))])]
!   "TARGET_SINGLE_STRINGOP"
    "ix86_current_function_needs_cld = 1;")
  
  (define_insn "*strsetdi_rex_1"
--- 18917,18923 ----
  		   (match_operand 2 "register_operand" ""))
  	      (set (match_operand 0 "register_operand" "")
  		   (match_operand 3 "" ""))])]
!   ""
    "ix86_current_function_needs_cld = 1;")
  
  (define_insn "*strsetdi_rex_1"
***************
*** 18926,18932 ****
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 8)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "stosq"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
--- 18926,18932 ----
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 8)))]
!   "TARGET_64BIT"
    "stosq"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
***************
*** 18938,18944 ****
     (set (match_operand:SI 0 "register_operand" "=D")
  	(plus:SI (match_dup 1)
  		 (const_int 4)))]
!   "!TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "stos{l|d}"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
--- 18938,18944 ----
     (set (match_operand:SI 0 "register_operand" "=D")
  	(plus:SI (match_dup 1)
  		 (const_int 4)))]
!   "!TARGET_64BIT"
    "stos{l|d}"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
***************
*** 18950,18956 ****
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 4)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "stos{l|d}"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
--- 18950,18956 ----
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 4)))]
!   "TARGET_64BIT"
    "stos{l|d}"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
***************
*** 18962,18968 ****
     (set (match_operand:SI 0 "register_operand" "=D")
  	(plus:SI (match_dup 1)
  		 (const_int 2)))]
!   "!TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "stosw"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
--- 18962,18968 ----
     (set (match_operand:SI 0 "register_operand" "=D")
  	(plus:SI (match_dup 1)
  		 (const_int 2)))]
!   "!TARGET_64BIT"
    "stosw"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
***************
*** 18974,18980 ****
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 2)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "stosw"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
--- 18974,18980 ----
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 2)))]
!   "TARGET_64BIT"
    "stosw"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
***************
*** 18986,18992 ****
     (set (match_operand:SI 0 "register_operand" "=D")
  	(plus:SI (match_dup 1)
  		 (const_int 1)))]
!   "!TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "stosb"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
--- 18986,18992 ----
     (set (match_operand:SI 0 "register_operand" "=D")
  	(plus:SI (match_dup 1)
  		 (const_int 1)))]
!   "!TARGET_64BIT"
    "stosb"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
***************
*** 18998,19004 ****
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 1)))]
!   "TARGET_64BIT && TARGET_SINGLE_STRINGOP"
    "stosb"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
--- 18998,19004 ----
     (set (match_operand:DI 0 "register_operand" "=D")
  	(plus:DI (match_dup 1)
  		 (const_int 1)))]
!   "TARGET_64BIT"
    "stosb"
    [(set_attr "type" "str")
     (set_attr "memory" "store")
Comment 5 H.J. Lu 2008-08-07 14:52:14 UTC
(In reply to comment #4)
> Subject: Re:  [4.4 Regression] Revision 138835 breaks bootstrap
> 
> Hi,
> thanks for testcase, for some reason it does not reproduce on our
> testing setup, probably due to ancient glibc that still has
> memcpy/memset inlines.
> 
> This patch should fix it, I am testing it right now but I am not sure I
> will be able to commit before tomorro wunforutnately.
> The problem is that we now use single stringops on optimize_size
> regions, but the patterns are disabled. It is not problem to enable
> them; we never produce them directly, only via the stringop expanders.
> (at least I am convinced combine won't produce this)
> 

I am testing it now. I will commit it for you if it works and no one
beats me on it.  Thanks.
Comment 6 Jan Hubicka 2008-08-07 14:56:45 UTC
Subject: Bug 37048

Author: hubicka
Date: Thu Aug  7 14:55:32 2008
New Revision: 138841

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138841
Log:
	PR target/37048
	* i386.md (single stringop patterns): Enable unconditionally. 

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.md

Comment 7 H.J. Lu 2008-08-07 17:23:31 UTC
Fixed.