[cfe-commits] r55039 - in /cfe/trunk: lib/Sema/Sema.h lib/Sema/SemaExpr.cpp test/CodeGen/2008-08-19-cast-of-typedef.c
Argiris Kirtzidis
akyrtzi at gmail.com
Wed Aug 20 03:58:50 PDT 2008
Daniel Dunbar wrote:
> Author: ddunbar
> Date: Tue Aug 19 22:55:42 2008
> New Revision: 55039
>
> URL: http://llvm.org/viewvc/llvm-project?rev=55039&view=rev
> Log:
> Fix subtle bug introduced in r54852.
> - UsualUnaryConversions takes an Expr *& and may modify its argument,
> this broke when it was refactored into Sema::CheckCastTypes. This
> meant that we were missing implicit casts in some places.
> - Seems pretty sad that this got through our tests.
>
Oops, sorry for introducing the bug!
-Argiris
> Added:
> cfe/trunk/test/CodeGen/2008-08-19-cast-of-typedef.c
> Modified:
> cfe/trunk/lib/Sema/Sema.h
> cfe/trunk/lib/Sema/SemaExpr.cpp
>
> Modified: cfe/trunk/lib/Sema/Sema.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=55039&r1=55038&r2=55039&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/Sema.h (original)
> +++ cfe/trunk/lib/Sema/Sema.h Tue Aug 19 22:55:42 2008
> @@ -871,7 +871,7 @@
> bool CheckStringLiteralInit(StringLiteral *strLiteral, QualType &DeclT);
>
> /// CheckCastTypes - Check type constraints for casting between types.
> - bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *CastExpr);
> + bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *&CastExpr);
>
> // CheckVectorCast - check type constraints for vectors.
> // Since vectors are an extension, there are no C standard reference for this.
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=55039&r1=55038&r2=55039&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Aug 19 22:55:42 2008
> @@ -1089,7 +1089,7 @@
> }
>
> /// CheckCastTypes - Check type constraints for casting between types.
> -bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *castExpr) {
> +bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr) {
> UsualUnaryConversions(castExpr);
>
> // C99 6.5.4p2: the cast type needs to be void or scalar and the expression
>
> Added: cfe/trunk/test/CodeGen/2008-08-19-cast-of-typedef.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2008-08-19-cast-of-typedef.c?rev=55039&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGen/2008-08-19-cast-of-typedef.c (added)
> +++ cfe/trunk/test/CodeGen/2008-08-19-cast-of-typedef.c Tue Aug 19 22:55:42 2008
> @@ -0,0 +1,10 @@
> +// RUN: clang --emit-llvm -o %t %s
> +
> +typedef short T[4];
> +struct s {
> + T f0;
> +};
> +
> +void foo(struct s *x) {
> + bar((long) x->f0);
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
More information about the cfe-commits
mailing list