Bug 103003 - gcc internal compiler error when doing large constant shifts
gcc internal compiler error when doing large constant shifts
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc3 (Show other bugs)
8.0
athlon Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-08-25 00:04 EDT by Mu
Modified: 2007-04-18 12:57 EDT (History)
0 users

See Also:
Fixed In Version: 3.2.2-5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-08-25 07:52:16 EDT
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 Mu 2003-08-25 00:04:39 EDT
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 07:52:16 EDT
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.