[cfe-commits] r160394 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/CXX/expr/expr.const/p2-0x.cpp test/Sema/const-eval.c test/SemaCXX/constant-expression.cpp

NAKAMURA Takumi geek4civic at gmail.com
Tue Jul 17 17:00:02 PDT 2012


Eli, it seems it might be i686-incompatible.

error: 'error' diagnostics seen but not expected:
  Line 118: variable length array declaration not allowed at file scope
error: 'warning' diagnostics expected but not seen:
  Line 118: size of static array must be an integer constant expression
2 errors generated.

http://llvm-amd64.freebsd.your.org:8010/builders/clang-i386-freebsd/builds/6127
http://bb.pgr.jp/builders/cmake-clang-i686-msvc10/builds/1445

...Takumi

2012/7/18 Eli Friedman <eli.friedman at gmail.com>:
> Author: efriedma
> Date: Tue Jul 17 16:03:05 2012
> New Revision: 160394
>
> URL: http://llvm.org/viewvc/llvm-project?rev=160394&view=rev
> Log:
> Don't treat overflow in floating-point conversions as a hard error in constant evaluation. <rdar://problem/11874571>.
>
>
> Modified:
>     cfe/trunk/lib/AST/ExprConstant.cpp
>     cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp
>     cfe/trunk/test/Sema/const-eval.c
>     cfe/trunk/test/SemaCXX/constant-expression.cpp
>
> Modified: cfe/trunk/lib/AST/ExprConstant.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=160394&r1=160393&r2=160394&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ExprConstant.cpp (original)
> +++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Jul 17 16:03:05 2012
> @@ -1151,11 +1151,10 @@
>  }
>
>  template<typename T>
> -static bool HandleOverflow(EvalInfo &Info, const Expr *E,
> +static void HandleOverflow(EvalInfo &Info, const Expr *E,
>                             const T &SrcValue, QualType DestType) {
> -  Info.Diag(E, diag::note_constexpr_overflow)
> +  Info.CCEDiag(E, diag::note_constexpr_overflow)
>      << SrcValue << DestType;
> -  return false;
>  }
>
>  static bool HandleFloatToIntCast(EvalInfo &Info, const Expr *E,
> @@ -1169,7 +1168,7 @@
>    bool ignored;
>    if (Value.convertToInteger(Result, llvm::APFloat::rmTowardZero, &ignored)
>        & APFloat::opInvalidOp)
> -    return HandleOverflow(Info, E, Value, DestType);
> +    HandleOverflow(Info, E, Value, DestType);
>    return true;
>  }
>
> @@ -1181,7 +1180,7 @@
>    if (Result.convert(Info.Ctx.getFloatTypeSemantics(DestType),
>                       APFloat::rmNearestTiesToEven, &ignored)
>        & APFloat::opOverflow)
> -    return HandleOverflow(Info, E, Value, DestType);
> +    HandleOverflow(Info, E, Value, DestType);
>    return true;
>  }
>
> @@ -1204,7 +1203,7 @@
>    if (Result.convertFromAPInt(Value, Value.isSigned(),
>                                APFloat::rmNearestTiesToEven)
>        & APFloat::opOverflow)
> -    return HandleOverflow(Info, E, Value, DestType);
> +    HandleOverflow(Info, E, Value, DestType);
>    return true;
>  }
>
>
> Modified: cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp?rev=160394&r1=160393&r2=160394&view=diff
> ==============================================================================
> --- cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp (original)
> +++ cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp Tue Jul 17 16:03:05 2012
> @@ -131,14 +131,14 @@
>  namespace UndefinedBehavior {
>    void f(int n) {
>      switch (n) {
> -    case (int)4.4e9: // expected-error {{constant expression}} expected-note {{value 4.4E+9 is outside the range of representable values of type 'int'}}
> +    case (int)4.4e9: // expected-error {{constant expression}} expected-note {{value 4.4E+9 is outside the range of representable values of type 'int'}} expected-note {{previous case defined here}}
>      case (int)0x80000000u: // ok
>      case (int)10000000000ll: // expected-note {{here}}
>      case (unsigned int)10000000000ll: // expected-error {{duplicate case value}}
>      case (int)(unsigned)(long long)4.4e9: // ok
> -    case (int)(float)1e300: // expected-error {{constant expression}} expected-note {{value 1.0E+300 is outside the range of representable values of type 'float'}}
> +    case (int)(float)1e300: // expected-error {{constant expression}} expected-note {{value 1.0E+300 is outside the range of representable values of type 'float'}} expected-error {{duplicate case value '2147483647'}} expected-note {{previous case defined here}}
>      case (int)((float)1e37 / 1e30): // ok
> -    case (int)(__fp16)65536: // expected-error {{constant expression}} expected-note {{value 65536 is outside the range of representable values of type 'half'}}
> +    case (int)(__fp16)65536: // expected-error {{constant expression}} expected-note {{value 65536 is outside the range of representable values of type 'half'}} expected-error {{duplicate case value '2147483647'}}
>        break;
>      }
>    }
>
> Modified: cfe/trunk/test/Sema/const-eval.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/const-eval.c?rev=160394&r1=160393&r2=160394&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/const-eval.c (original)
> +++ cfe/trunk/test/Sema/const-eval.c Tue Jul 17 16:03:05 2012
> @@ -131,3 +131,6 @@
>
>  extern struct Test50S Test50;
>  EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned)&Test50 + 10)) // expected-error {{must have a constant size}}
> +
> +// <rdar://problem/11874571>
> +EVAL_EXPR(51, 0 != (float)1e99)
>
> Modified: cfe/trunk/test/SemaCXX/constant-expression.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression.cpp?rev=160394&r1=160393&r2=160394&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/constant-expression.cpp (original)
> +++ cfe/trunk/test/SemaCXX/constant-expression.cpp Tue Jul 17 16:03:05 2012
> @@ -115,7 +115,7 @@
>  namespace FloatConvert {
>    typedef int a[(int)42.3];
>    typedef int a[(int)42.997];
> -  typedef int b[(int)4e10]; // expected-warning {{variable length}} expected-error {{variable length}}
> +  typedef int b[(int)4e10]; // expected-warning {{variable length}} expected-warning {{size of static array must be an integer constant expression}}
>  }
>
>  // PR12626
>
>
> _______________________________________________
> 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