c - Bug with __int128_t in Clang? -


this little code compiles both gcc , clang, gives different results:

#include <stdio.h>  int main(){    __int128_t test=10;   while(test>0){     int mytest=(int)test;     printf("? %d\n", mytest);     test--;   }  } 

with gcc counts 10 down 1, intended behaviour, while clang keeps on counting negative numbers. clang, if replace test-- test-=1 gives expected behaviour well.

__int128_t gcc extension, above results apply non-standard c, maybe __int128_t "use @ own risk" in clang.

is bug in clang, or did make mistake i'm not seeing?

edit: i'm using gcc (macports gcc48 4.8-20130411_0) 4.8.1 20130411 (prerelease) , apple clang version 4.0 (tags/apple/clang-421.0.60) (based on llvm 3.1svn).

this bug in clang, resolved somewhere between apple clang version 4.0 (tags/apple/clang-421.0.60) (based on llvm 3.1svn) , apple llvm version 4.2 (clang-425.0.28) (based on llvm 3.2svn), see comments -- carl , h2co3.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -