http://llvm.org/bugs/show_bug.cgi?id=18914
Bug ID: 18914
Summary: No conversion warning on bitfields
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
trunk 201801
$: cat s.c
struct S {unsigned x:3;} s;
void f(unsigned sm) {
s.x = sm;// no warning here.
s.x = 9999111;
}
$: clang-trunk -Wconversion s.c -c
s.c:4:7: warning: implicit truncation from 'int' to bitfield changes value from
9999111 to 7
[-Wbitfield-constant-conversion]
s.x = 9999111;
^ ~~~~~~~
1 warning generated.
$: gcc-trunk -Wconversion s.c -c
s.c: In function ‘f’:
s.c:3:9: warning: conversion to ‘unsigned char:3’ from ‘unsigned int’ may alter
its value [-Wconversion]
s.x = sm;// no warning here.
^
s.c:4:9: warning: large integer implicitly truncated to unsigned type
[-Woverflow]
s.x = 9999111;
^
$
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs