[cfe-commits] r67721 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/CodeGen/PR3869-indirect-goto-long.c
Eli Friedman
eli.friedman at gmail.com
Wed Mar 25 17:18:07 PDT 2009
Author: efriedma
Date: Wed Mar 25 19:18:06 2009
New Revision: 67721
URL: http://llvm.org/viewvc/llvm-project?rev=67721&view=rev
Log:
Fix for PR3869: actually enforce that the argument of an indirect goto
is of type void*. I'll try to add the appropriate checking later.
Added:
cfe/trunk/test/CodeGen/PR3869-indirect-goto-long.c
Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=67721&r1=67720&r2=67721&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Mar 25 19:18:06 2009
@@ -688,8 +688,10 @@
Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc,
ExprArg DestExp) {
// FIXME: Verify that the operand is convertible to void*.
-
- return Owned(new (Context) IndirectGotoStmt((Expr*)DestExp.release()));
+ // Convert operand to void*
+ Expr* E = (Expr*)DestExp.release();
+ ImpCastExprToType(E, Context.VoidPtrTy);
+ return Owned(new (Context) IndirectGotoStmt(E));
}
Action::OwningStmtResult
Added: cfe/trunk/test/CodeGen/PR3869-indirect-goto-long.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/PR3869-indirect-goto-long.c?rev=67721&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/PR3869-indirect-goto-long.c (added)
+++ cfe/trunk/test/CodeGen/PR3869-indirect-goto-long.c Wed Mar 25 19:18:06 2009
@@ -0,0 +1,4 @@
+// RUN: clang-cc -emit-llvm-bc -o - %s
+// PR3869
+int a(long long b) { goto *b; }
+
More information about the cfe-commits
mailing list