https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65179
Bug ID: 65179
Summary: Introduce new C warning: -Wshift-negative-value
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: mpolacek at gcc dot gnu.org
For cases, where we shift a negative value, it can be useful to produce a
warning:
int main()
{
return -3 << 4;
}
similar to what is produced by undefined behavior sanitizer:
$ gcc -fsanitize=undefined /tmp/c.c
$ ./a.out
/tmp/c.c:3:13: runtime error: left shift of negative value -3
Thanks,
Martin