On Sun, Jul 26, 2015 at 6:58 PM, Saleem Abdulrasool <[email protected]> wrote:
> On Sun, Jul 26, 2015 at 2:02 AM, David Majnemer <[email protected]> > wrote: > >> Author: majnemer >> Date: Sun Jul 26 04:02:26 2015 >> New Revision: 243243 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=243243&view=rev >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243243-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=Y_L85-cj_prla13CIMoO-QM0u4Ulpz--eZ5LnIr-TK8&s=vHK5_-kXeIViHSTsJSUo2hRP3egmioRNFU6ao1GMRU8&e=> >> Log: >> [MS Extensions] Remove support for the i128 integer literal suffix >> >> There is currently no support in MSVC for using i128 as an integer >> literal suffix. In fact, there appears to be no evidence that they have >> ever supported this feature in any of their compilers. This was an over >> generalization of their actual feature and is a nasty source of bugs. >> Why is it a source of bugs? Because most code in clang expects that >> evaluation of an integer constant expression won't give them something >> that 'long long' can't represent. Instead of providing a meaningful >> feature, i128 gives us cute ways of exploding the compiler. >> > > https://msdn.microsoft.com/en-us/library/cc953fe1.aspx > <https://urldefense.proofpoint.com/v2/url?u=https-3A__msdn.microsoft.com_en-2Dus_library_cc953fe1.aspx&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=Y_L85-cj_prla13CIMoO-QM0u4Ulpz--eZ5LnIr-TK8&s=uZaMn5xiflWZHlTPmNHb4LrItXxuvCsIXWnYFWAsVyM&e=> > claims otherwise. > > Under Microsoft Specific types: > > *__int* *n* > > 8, 16, 32, 64, or 128 bits depending on the value of *n**. __int**n* is > Microsoft-specific. > > __int128 as a type is fine (and supported), this commit removed support for 128 bit literals, e.g. __int128 x = 42i128; - Ben Modified: >> cfe/trunk/lib/Lex/LiteralSupport.cpp >> cfe/trunk/lib/Sema/SemaExpr.cpp >> cfe/trunk/test/Lexer/ms-extensions.c >> cfe/trunk/test/Sema/128bitint.c >> cfe/trunk/test/SemaCXX/ms_integer_suffix.cpp >> >> Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=243243&r1=243242&r2=243243&view=diff >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_Lex_LiteralSupport.cpp-3Frev-3D243243-26r1-3D243242-26r2-3D243243-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=Y_L85-cj_prla13CIMoO-QM0u4Ulpz--eZ5LnIr-TK8&s=cLoMbjQv7fJQ7G6QkMle-7L-PK3tAuvui9CzAKlwFGU&e=> >> >> ============================================================================== >> --- cfe/trunk/lib/Lex/LiteralSupport.cpp (original) >> +++ cfe/trunk/lib/Lex/LiteralSupport.cpp Sun Jul 26 04:02:26 2015 >> @@ -613,7 +613,7 @@ NumericLiteralParser::NumericLiteralPars >> break; >> >> if (!isFPConstant) { >> - // Allow i8, i16, i32, i64, and i128. >> + // Allow i8, i16, i32, and i64. >> switch (s[1]) { >> case '8': >> s += 2; // i8 suffix >> @@ -623,9 +623,6 @@ NumericLiteralParser::NumericLiteralPars >> if (s[2] == '6') { >> s += 3; // i16 suffix >> MicrosoftInteger = 16; >> - } else if (s[2] == '2' && s[3] == '8') { >> - s += 4; // i128 suffix >> - MicrosoftInteger = 128; >> } >> break; >> case '3': >> >> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=243243&r1=243242&r2=243243&view=diff >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_Sema_SemaExpr.cpp-3Frev-3D243243-26r1-3D243242-26r2-3D243243-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=Y_L85-cj_prla13CIMoO-QM0u4Ulpz--eZ5LnIr-TK8&s=DBhkqfMKb5aW-Aq12GG-2hG_DGzfWt_RL0Sswla-MYI&e=> >> >> >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Jul 26 04:02:26 2015 >> @@ -3355,13 +3355,6 @@ ExprResult Sema::ActOnNumericConstant(co >> >> // Get the value in the widest-possible width. >> unsigned MaxWidth = Context.getTargetInfo().getIntMaxTWidth(); >> - // The microsoft literal suffix extensions support 128-bit literals, >> which >> - // may be wider than [u]intmax_t. >> - // FIXME: Actually, they don't. We seem to have accidentally >> invented the >> - // i128 suffix. >> - if (Literal.MicrosoftInteger == 128 && MaxWidth < 128 && >> - Context.getTargetInfo().hasInt128Type()) >> - MaxWidth = 128; >> llvm::APInt ResultVal(MaxWidth, 0); >> >> if (Literal.GetIntegerValue(ResultVal)) { >> @@ -3384,12 +3377,7 @@ ExprResult Sema::ActOnNumericConstant(co >> >> // Microsoft specific integer suffixes are explicitly sized. >> if (Literal.MicrosoftInteger) { >> - if (Literal.MicrosoftInteger > MaxWidth) { >> - // If this target doesn't support __int128, error and force to >> ull. >> - Diag(Tok.getLocation(), diag::err_int128_unsupported); >> - Width = MaxWidth; >> - Ty = Context.getIntMaxType(); >> - } else if (Literal.MicrosoftInteger == 8 && !Literal.isUnsigned) >> { >> + if (Literal.MicrosoftInteger == 8 && !Literal.isUnsigned) { >> Width = 8; >> Ty = Context.CharTy; >> } else { >> >> Modified: cfe/trunk/test/Lexer/ms-extensions.c >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/ms-extensions.c?rev=243243&r1=243242&r2=243243&view=diff >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Lexer_ms-2Dextensions.c-3Frev-3D243243-26r1-3D243242-26r2-3D243243-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=Y_L85-cj_prla13CIMoO-QM0u4Ulpz--eZ5LnIr-TK8&s=BTTdgPegnIDOdpdcppu_JmOXP2v7ze27LbwbckN1smo&e=> >> >> ============================================================================== >> --- cfe/trunk/test/Lexer/ms-extensions.c (original) >> +++ cfe/trunk/test/Lexer/ms-extensions.c Sun Jul 26 04:02:26 2015 >> @@ -7,10 +7,6 @@ __int16 x2 = 4i16; >> __int32 x3 = 5i32; >> __int64 x5 = 0x42i64; >> __int64 x6 = 0x42I64; >> -#ifndef __SIZEOF_INT128__ >> -// expected-error@+2 {{__int128 is not supported on this target}} >> -#endif >> -__int64 x4 = 70000000i128; >> >> __int64 y = 0x42i64u; // expected-error {{invalid suffix}} >> __int64 w = 0x43ui64; >> >> Modified: cfe/trunk/test/Sema/128bitint.c >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/128bitint.c?rev=243243&r1=243242&r2=243243&view=diff >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Sema_128bitint.c-3Frev-3D243243-26r1-3D243242-26r2-3D243243-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=Y_L85-cj_prla13CIMoO-QM0u4Ulpz--eZ5LnIr-TK8&s=5DccQKkoz5XvbVkhbNxt28VSnv3k_H_EHkAb0mSxWBM&e=> >> >> >> ============================================================================== >> --- cfe/trunk/test/Sema/128bitint.c (original) >> +++ cfe/trunk/test/Sema/128bitint.c Sun Jul 26 04:02:26 2015 >> @@ -1,5 +1,5 @@ >> -// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 >> -fms-extensions %s -DHAVE >> -// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux-gnu >> -fms-extensions %s -DHAVE_NOT >> +// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 %s >> -DHAVE >> +// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux-gnu %s >> -DHAVE_NOT >> >> #ifdef HAVE >> typedef int i128 __attribute__((__mode__(TI))); >> @@ -17,28 +17,14 @@ __int128 i = (__int128)0; >> unsigned __int128 u = (unsigned __int128)-1; >> >> long long SignedTooBig = 123456789012345678901234567890; // >> expected-error {{integer literal is too large to be represented in any >> integer type}} >> -__int128_t Signed128 = 123456789012345678901234567890i128; >> -long long Signed64 = 123456789012345678901234567890i128; // >> expected-warning {{implicit conversion from '__int128' to 'long long' >> changes value from 123456789012345678901234567890 to -4362896299872285998}} >> unsigned long long UnsignedTooBig = 123456789012345678901234567890; // >> expected-error {{integer literal is too large to be represented in any >> integer type}} >> -__uint128_t Unsigned128 = 123456789012345678901234567890Ui128; >> -unsigned long long Unsigned64 = 123456789012345678901234567890Ui128; // >> expected-warning {{implicit conversion from 'unsigned __int128' to >> 'unsigned long long' changes value from 123456789012345678901234567890 to >> 14083847773837265618}} >> - >> -// Ensure we don't crash when user passes 128-bit values to type safety >> -// attributes. >> -void pointer_with_type_tag_arg_num_1(void *buf, int datatype) >> - __attribute__(( pointer_with_type_tag(mpi,0x10000000000000001i128,1) >> )); // expected-error {{attribute parameter 2 is out of bounds}} >> - >> -void pointer_with_type_tag_arg_num_2(void *buf, int datatype) >> - __attribute__(( pointer_with_type_tag(mpi,1,0x10000000000000001i128) >> )); // expected-error {{attribute parameter 3 is out of bounds}} >> >> void MPI_Send(void *buf, int datatype) __attribute__(( >> pointer_with_type_tag(mpi,1,2) )); >> >> -static const __uint128_t mpi_int_wrong __attribute__(( >> type_tag_for_datatype(mpi,int) )) = 0x10000000000000001i128; // >> expected-error {{'type_tag_for_datatype' attribute requires the initializer >> to be an integer constant expression that can be represented by a 64 bit >> integer}} >> static const int mpi_int __attribute__(( type_tag_for_datatype(mpi,int) >> )) = 10; >> >> void test(int *buf) >> { >> - MPI_Send(buf, 0x10000000000000001i128); // expected-warning {{implicit >> conversion from '__int128' to 'int' changes value}} >> } >> #else >> >> >> Modified: cfe/trunk/test/SemaCXX/ms_integer_suffix.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms_integer_suffix.cpp?rev=243243&r1=243242&r2=243243&view=diff >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_SemaCXX_ms-5Finteger-5Fsuffix.cpp-3Frev-3D243243-26r1-3D243242-26r2-3D243243-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=Y_L85-cj_prla13CIMoO-QM0u4Ulpz--eZ5LnIr-TK8&s=nsDflFhecmQKxPWXfGpPRvOh2nO6o8TLWiuoib12kUo&e=> >> >> ============================================================================== >> --- cfe/trunk/test/SemaCXX/ms_integer_suffix.cpp (original) >> +++ cfe/trunk/test/SemaCXX/ms_integer_suffix.cpp Sun Jul 26 04:02:26 2015 >> @@ -18,6 +18,3 @@ static_assert(sizeof(0i32) == __SIZEOF_I >> #ifdef __SIZEOF_INT64__ >> static_assert(sizeof(0i64) == __SIZEOF_INT64__, ""); >> #endif >> -#ifdef __SIZEOF_INT128__ >> -static_assert(sizeof(0i128) == __SIZEOF_INT128__, ""); >> -#endif >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> > > > > -- > Saleem Abdulrasool > compnerd (at) compnerd (dot) org > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
