https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70779
Bug ID: 70779
Summary: -trapv does not generate trapping vode for integer
conversions
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: igodard at pacbell dot net
Target Milestone: ---
This source:
extern int si; extern unsigned ui;
int main(int argc, char** argv) {
return argc==0?si:ui; }
compiled with this command line:
gcc -S -O3 -ftrapv src/test2.c
gets this code:
main:
.LFB0:
.cfi_startproc
testl %edi, %edi
movl ui(%rip), %eax
cmove si(%rip), %eax
ret
.cfi_endproc
Note that there is no check for overflow.