Bug 67516 - class.c left shift of 1271241028 by 4 places cannot be represented in type 'int'
Summary: class.c left shift of 1271241028 by 4 places cannot be represented in type 'int'
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libobjc (show other bugs)
Version: 5.2.0
: P3 normal
Target Milestone: ---
Assignee: Andrew Pinski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-09 12:04 UTC by Vittorio Zecca
Modified: 2021-02-21 08:10 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-09-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vittorio Zecca 2015-09-09 12:04:20 UTC
Running 'make check' on objc I get many sanitizer messages as in

/home/vitti/gcc-5.2.0/libobjc/class.c:186:3: runtime error: left shift of 1271241028 by 4 places cannot be represented in type 'int'

and

/home/vitti/gcc-5.2.0/libobjc/class.c:215:3: runtime error: left shift of 1271241028 by 4 places cannot be represented in type 'int'

The target instruction is 

CLASS_TABLE_HASH (length, hash, class_name);

The macro contains 

 HASH = (HASH << 4) ^ (HASH >> 28) ^ CLASS_NAME[INDEX];

which probably provokes the sanitizer massages. 

Target: x86_64-unknown-linux-gnu
Comment 1 Andrew Pinski 2015-09-09 13:24:15 UTC
A cast to unsigned should be the correct thing here or rather hash should be an unsigned type.

Mine.
Comment 2 Vittorio Zecca 2021-02-21 08:10:42 UTC
Resolved.