[LLVMbugs] [Bug 9357] New: clang doesn't DCE dead switch cases, take 2
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 1 11:44:40 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9357
Summary: clang doesn't DCE dead switch cases, take 2
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: pageexec at freemail.hu
CC: llvmbugs at cs.uiuc.edu, pageexec at freemail.hu
Blocks: 4068
cloning from bug 9322 comment 9 per Ted's request.
in linux/kernel/signal.c:has_pending_signals there's the following construct
(linux/include/linux/signal.h has similar):
102 »·······switch (_NSIG_WORDS) {
103 »·······default:
104 »·······»·······for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
105 »·······»·······»·······ready |= signal->sig[i] &~ blocked->sig[i];
106 »·······»·······break;
107
108 »·······case 4: ready = signal->sig[3] &~ blocked->sig[3];
109 »·······»·······ready |= signal->sig[2] &~ blocked->sig[2];
110 »·······»·······ready |= signal->sig[1] &~ blocked->sig[1];
111 »·······»·······ready |= signal->sig[0] &~ blocked->sig[0];
112 »·······»·······break;
113
114 »·······case 2: ready = signal->sig[1] &~ blocked->sig[1];
115 »·······»·······ready |= signal->sig[0] &~ blocked->sig[0];
116 »·······»·······break;
117
118 »·······case 1: ready = signal->sig[0] &~ blocked->sig[0];
119 »·······}
on i386 _NSIG_WORDS is #defined to 2 with ->sig[] having 2 elements as well.
clang r126742 generates the following warning on this:
kernel/signal.c:108:19: warning: array index of '3' indexes past the end of an
array (that contains 2 elements) [-Warray-bounds]
case 4: ready = signal->sig[3] &~ blocked->sig[3];
and ditto for line 109.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list