Bug 58204 - gcc Unrecognizable insn using do_div
gcc Unrecognizable insn using do_div
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-01-10 19:14 EST by Keith Owens
Modified: 2007-04-18 12:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 14:06:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Keith Owens 2002-01-10 19:14:06 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.17-xfs i586)

Description of problem:
Interleaved assignment statements and do_div operations on
unsigned long long variables followed by a function call that uses
those variables breaks gcc 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
with an Unrecognizable insn.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create gcc_bug.c containing

#include <asm/div64.h>

void gcc_bug(unsigned long long *len_p)
{
	unsigned long long bno;
	unsigned long long len;

	bno = 2000;
	do_div(bno, 12);
	len = *len_p;
	do_div(len, 24);
	printf("%lld %lld\n", bno, len);
}

2. gcc -O2 -c gcc_bug.c
3.
	

Actual Results:  gcc_bug.c: In function `gcc_bug':
gcc_bug.c:13: Unrecognizable insn:
(insn 49 153 147 (parallel[ 
            (set (reg:SI 0 eax)
                (asm_operands ("") ("=a") 0[ 
                        (reg:DI 1 edx)
                    ] 
                    [ 
                        (asm_input:DI ("A"))
                    ]  ("gcc_bug.c") 11))
            (set (reg:SI 1 edx)
                (asm_operands ("") ("=d") 1[ 
                        (reg:DI 1 edx)
                    ] 
                    [ 
                        (asm_input:DI ("A"))
                    ]  ("gcc_bug.c") 11))
            (clobber (reg:QI 19 dirflag))
            (clobber (reg:QI 18 fpsr))
            (clobber (reg:QI 17 flags))
        ] ) -1 (insn_list 45 (nil))
    (nil))
gcc_bug.c:13: confused by earlier errors, bailing out

Expected Results:  Clean compile.

Additional info:

Doing both the assignments before the calls to do_div makes the
problem disappear.  Doing two calls to printf with one variable on
each call makes the problem disappear.  Assigning len from a constant
instead of from a parameter makes the problem disappear.  Passing len
directly instead of via a pointer makes the problem disappear.

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
Comment 1 Alan Cox 2002-12-15 14:06:51 EST
Ok with gcc 3.2

Note You need to log in before you can comment on or make changes to this bug.