Strange that this is undefined behavior in C. Is it only when left shifting a constant or any signed integer expression? In general I can understand it is undefined because it depends on the size of the integer type, but here ___TB is 3 so -7<<___TB will fit in any integer type including 8 bit integers!
Also, I don’t understand why gsi gets stuck. After all you only got warnings.
Can you give more details, such as OS and Gambit versions? I use the latest clang from Xcode and don’t have this problem.
Marc
On Jan 19, 2016, at 3:35 AM, Alex Silva asandroq@gmail.com wrote:
Hallo,
Just a heads up: While compiling Gambit, Clang displays the following warning (thousands of times):
_gambitgsc.c:27730:1: warning: shifting a negative signed value is undefined [-Wshift-negative-value] ___DEF_NEW_SYM_GLO(___S_xmm5,___S_xmm6,___X3334,376674065,___G_xmm6) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/gambit.h:5487:35: note: expanded from macro '___DEF_NEW_SYM_GLO' ___EXP_DATA(___glo_struct,glo) = {___UNB1, ___FIX(hash), 0}; \ ^~~~~~~ ../include/gambit.h:2098:38: note: expanded from macro '___UNB1' #define ___UNB1 ((___CAST(___WORD,-7)<<___TB)+___tSPECIAL) ~~~~~~~~~~~~~~~~~~~^
This is indeed undefined behaviour according to the C standard[1]. The resulting `gsi` gets stuck when started and must be killed with SIGKILL.
[1] http://stackoverflow.com/a/22883850/341446
Cheers,
-alex http://unendli.ch/ _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list