From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24098 invoked by alias); 21 Jun 2002 01:06:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24074 invoked by uid 71); 21 Jun 2002 01:06:02 -0000 Resent-Date: 21 Jun 2002 01:06:02 -0000 Resent-Message-ID: <20020621010602.24072.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, peter@llama.nslug.ns.ca Received: (qmail 20898 invoked from network); 21 Jun 2002 00:58:56 -0000 Received: from unknown (HELO llama.nslug.ns.ca) (24.222.156.67) by sources.redhat.com with SMTP; 21 Jun 2002 00:58:56 -0000 Received: from peter by llama.nslug.ns.ca with local (Exim 3.35 #1 (Debian)) id 17LClL-0004Yg-00; Thu, 20 Jun 2002 21:58:55 -0300 Message-Id: Date: Thu, 20 Jun 2002 18:21:00 -0000 From: peter@llama.nslug.ns.ca To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org X-Send-Pr-Version: 3.113 Subject: target/7091: ice with gcc 3.1 when optimizing for k6 X-SW-Source: 2002-06/txt/msg00509.txt.bz2 List-Id: >Number: 7091 >Category: target >Synopsis: ice with gcc 3.1 when optimizing for k6 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: ice-on-legal-code >Submitter-Id: net >Arrival-Date: Thu Jun 20 18:06:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Peter Cordes >Release: 3.1.1 20020606 (Debian prerelease) (Debian testing/unstable) >Organization: >Environment: AMD k6-2 CPU. Also reproducable on an Intel P200MMX (still only when optimizing for k6). Debian Release: 3.0 Architecture: i386 Kernel: Linux yeti 2.4.18 #1 Thu Apr 4 17:15:43 AST 2002 i586 Locale: LANG=C, LC_CTYPE=C Debian GNU/Linux, using gcc-3.1 packages, version 3.1.1-0pre2. Versions of packages gcc-3.1 depends on: ii binutils 2.12.90.0.9-1 The GNU assembler, linker and bina ii cpp-3.1 1:3.1.1-0pre2 The GNU C preprocessor. ii gcc-3.1-base 1:3.1.1-0pre2 The GNU Compiler Collection (base ii libc6 2.2.5-6 GNU C Library: Shared libraries an ii libgcc1 1:3.1.1-0pre2 GCC support library. configured with: /mnt/data/gcc-3.1/gcc-3.1-3.1.1ds1/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/g++-v3-3.1 --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --enable-clocale=gnu --enable-threads=posix --enable-java-gc=boehm --enable-objc-gc i386-linux >Description: In case it matters, this code is from alsa 0.9.0rc1-2, pci/trident/trident_memory.c. The preprocessed source was 15000 lines, but only 100 of them are needed to trigger the bug. $ gcc-3.1 gcc_bug.c -c -O6 -march=k6 gcc_bug.c: In function snd_trident_synth_bzero': gcc_bug.c:106: unrecognizable insn: (insn 238 231 240 (set (reg:SI 99) (ashift:SI (plus:SI (reg/v:SI 63) (const_int -1 [0xffffffff])) (const_int 12 [0xc]))) -1 (insn_list 28 (nil)) (nil)) gcc_bug.c:106: Internal compiler error in extract_insn, at recog.c:2132 >How-To-Repeat: Compile this code with -O2 -mcpu=k6. -O1 doesn't do it. -mcpu=anything else doesn't do it either. (-O3 or higher ices too.) -------------------------------- gcc-bug.c typedef unsigned int size_t; static inline void * __memset_generic(void * s, char c,size_t count) { int d0, d1; __asm__ __volatile__( "rep\n\t" "stosb" : "=&c" (d0), "=&D" (d1) :"a" (c),"1" (s),"0" (count) :"memory"); return s; } static inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count) { switch (count) { case 0: return s; case 1: *(unsigned char *)s = pattern; return s; case 2: *(unsigned short *)s = pattern; return s; case 3: *(unsigned short *)s = pattern; *(2+(unsigned char *)s) = pattern; return s; case 4: *(unsigned long *)s = pattern; return s; } { int d0, d1; switch (count % 4) { case 0: __asm__ __volatile__( "rep ; stosl" "" : "=&c" (d0), "=&D" (d1) : "a" (pattern),"0" (count/4),"1" ((long) s) : "memory"); return s; case 1: __asm__ __volatile__( "rep ; stosl" "\n\tstosb" : "=&c" (d0), "=&D" (d1) : "a" (pattern),"0" (count/4),"1" ((long) s) : "memory"); return s; case 2: __asm__ __volatile__( "rep ; stosl" "\n\tstosw" : "=&c" (d0), "=&D" (d1) : "a" (pattern),"0" (count/4),"1" ((long) s) : "memory"); return s; default: __asm__ __volatile__( "rep ; stosl" "\n\tstosw\n\tstosb" : "=&c" (d0), "=&D" (d1) : "a" (pattern),"0" (count/4),"1" ((long) s) : "memory"); return s; } } } static inline void * __constant_c_memset(void * s, unsigned long c, size_t count) { int d0, d1; __asm__ __volatile__( "rep ; stosl\n\t" "testb $2,%b3\n\t" "je 1f\n\t" "stosw\n" "1:\ttestb $1,%b3\n\t" "je 2f\n\t" "stosb\n" "2:" : "=&c" (d0), "=&D" (d1) :"a" (c), "q" (count), "0" (count/4), "1" ((long) s) :"memory"); return (s); } typedef struct snd_util_memblk snd_util_memblk_t; struct snd_util_memblk { int size; int offset; }; typedef struct { unsigned long * shadow_entries; } snd_trident_tlb_t; typedef struct _snd_trident trident_t; struct _snd_trident { snd_trident_tlb_t tlb; }; int snd_trident_synth_bzero(trident_t *trident, snd_util_memblk_t *blk, int offset, int size); inline static void *offset_ptr(trident_t *trident, int offset) { char *ptr; ptr = (void*)((trident)->tlb.shadow_entries[((offset) >> 12)]); ptr += offset % (1UL << 12); return (void*)ptr; } int snd_trident_synth_bzero(trident_t *trident, snd_util_memblk_t *blk, int offset, int size) { int page, nextofs, end_offset, temp, temp1; offset += blk->offset; end_offset = offset + size; page = ((offset) >> 12) + 1; do { nextofs = ((page) << 12); temp = nextofs - offset; temp1 = end_offset - offset; if (temp1 < temp) temp = temp1; (__builtin_constant_p(0) ? (__builtin_constant_p((temp)) ? __constant_c_and_count_memset(((offset_ptr(trident, offset))),((0x01010101UL*(unsigned char)(0))),((temp))) : __constant_c_memset(((offset_ptr(trident, offset))),((0x01010101UL*(unsigned char)(0))),((temp)))) : (__builtin_constant_p((temp)) ? __memset_generic((((offset_ptr(trident, offset)))),(((0))),(((temp)))) : __memset_generic(((offset_ptr(trident, offset))),((0)),((temp))))); offset = nextofs; page++; } while (offset < end_offset); return 0; } ----------------------------------------------- >Fix: gcc-3.0 doesn't ice on this code. I don't know if it actually compiles it correctly or not. (Other alsa modules compiled with gcc-3.1 seemed to make my kernel unstable, but that's nothing to do with this.) >Release-Note: >Audit-Trail: >Unformatted: