Bug 103003 - gcc internal compiler error when doing large constant shifts
Summary: gcc internal compiler error when doing large constant shifts
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc3   
(Show other bugs)
Version: 8.0
Hardware: athlon
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-08-25 04:04 UTC by Mu
Modified: 2007-04-18 16:57 UTC (History)
0 users

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: ---


Attachments (Terms of Use)

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.


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