Bug 58204 - gcc Unrecognizable insn using do_div
Summary: gcc Unrecognizable insn using do_div
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2002-01-11 00:14 UTC by Keith Owens
Modified: 2007-04-18 16:38 UTC (History)
0 users

Clone Of:
Last Closed: 2002-12-15 19:06:51 UTC

Attachments (Terms of Use)

Description Keith Owens 2002-01-11 00:14:06 UTC
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:

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

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))
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 19:06:51 UTC
Ok with gcc 3.2

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