Bug 103003

Summary: gcc internal compiler error when doing large constant shifts
Product: [Retired] Red Hat Linux Reporter: Mu <mu>
Component: gcc3Assignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: athlon   
OS: Linux   
Whiteboard:
Fixed In Version: 3.2.2-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-25 11:52:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mu 2003-08-25 04:04:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030716

Description of problem:
gcc exits with an internal compiler error when trying to compile (buggy)  code.

Steps to reproduce:

$ cat gccbug.c
main()
{
 int p,q=1;
 p=q<<0xdead;
}

$ cc -o gccbug gccbug.c
gccbug.c: In function `main':
gccbug.c:4: warning: left shift count >= width of type
gccbug.c:5: unrecognizable insn:
(insn 20 17 22 (set (reg:QI 61)
        (const_int 57005 [0xdead])) -1 (nil)
    (nil))
gccbug.c:5: Internal compiler error in extract_insn, at recog.c:2148
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
make: *** [gccbug] Error 1
$ 


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

How reproducible:
Always

Expected Results:  
$ cc -o gccbug gccbug.c
gccbug.c: In function `main':
gccbug.c:4: warning: left shift count >= width of type
$

Additional info:

The case of a shift which is much > than the width of the type might 
want to be treated as an error, as it is unlikely to produce meaningful
results.

The code was initially:
 p=q<<16 + 0xdead;    

should've been
 p=(q<<16) + 0xdead;    

User error, but it should not cause an internal compiler error.

Comment 1 Jakub Jelinek 2003-08-25 11:52:16 UTC
Cannot reproduce this in either 3.2.2-5, 3.2.3-6 nor 3.3-14, so I guess this
has been fixed already.