.
D 2016-06-03T09:32:58.165
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment In\stcl\s8.6\sthere\sseems\sto\sbe\sa\sbug\sof\smissing\sparentheses\sin\sthe\sthread\spackage.\r\nAt\sthe\stop\sof\sthe\sfile\stcl8.6.1/pkgs/thread2.7.0/generic/threadCmd.c\r\nthere\sis\sa\sdefinition\s\r\n#define\sTHREAD_SEND_WAIT\s1<<1\r\n#define\sTHREAD_SEND_HEAD\s1<<2\r\n\r\nIt\sseems\sto\sme\sthat\sthis\sis\sintended\sto\sdefine\swhich\sspecific\sone\sbit\sto\suse\sin\r\nbitwise\soperations.\sThese\sare\sused\sfor\sexample\sin\sThreadSendObjCmd()\sin\sa\r\nline\slike:\s\r\n\r\nif\s(OPT_CMP(arg,\s"-async"))\s{\r\n\s\s\s\s\s\s\s\sflags\s&=\s~THREAD_SEND_WAIT;\r\n\s\s\s\s\s}\r\n\r\nThe\sproblem\sis\sthat\sthe\soperator\sprecedence\sof\sthe\sbitwise\snot\s("~")\sis\r\nhigher\sthan\sthe\sthe\sprecedence\sof\sthe\sshift\sleft\s("<<").\sWhile\sthe\r\nintended\sresult\sseems\sto\sbe\sto\scompute\s\r\n\s\s\s\s\sflags\s&=\s~(1<<1);\r\nwhat\sis\sactually\scomputed\sis\r\n\s\s\s\s\sflags\s&=\s(~1)<<1;\r\n\r\nAs\slong\sas\sthis\soperation\sis\sonly\sdone\son\sthe\sleast\ssignificant\sused\r\nbit\sout\sof\sall\sbits\sin\sthe\sbit\smask,\sthis\s"bug"\sprobably\shas\sno\spractical\s\r\neffect,\sexcept\sinvoking\sundefined\sbehavior\sof\sshifting\sinto\sand\spast\sthe\ssign\r\nbit\sof\sa\ssigned\svalue.\sHowever,\sif\sit\sis\sindeed\sa\sbug,\sit\shas\sthe\r\npotential\sto\sbecome\sa\shard-to-notice\smore\sserious\sproblem\swith\slater\r\ncode\schanges.\s\r\n\r\nPlease\sverify\swhether\sthe\sintention\sis\sindeed\sto\sclear\sout\sone\ssingle\sbit,\r\nor\sthat\sit\sclears\salso\sall\sbits\sthat\sare\sless\ssignificant\sat\sthe\ssame\stime.\r\nIn\scase\sthe\sintention\sis\sto\suse\s1<<1\sand\s1<<2\sto\sspecify\sa\ssingle\sbit\sin\r\na\sbit-mask,\smy\srecommendation\swould\sbe\sto\sinclude\sparentheses:\r\n#define\sTHREAD_SEND_WAIT\s(1<<1)\r\n#define\sTHREAD_SEND_HEAD\s(1<<2)\r\n\r\nThe\ssame\sproblem\sand\ssuggested\sfix\sapplies\sto\sthese\sthree\slines\sin\sthe\r\nnewer\sversion\sin\stcl8.6.5/pkgs/thread2.7.3/generic/threadCmd.c:\r\n#define\sTHREAD_SEND_WAIT\s1<<1\r\n#define\sTHREAD_SEND_HEAD\s1<<2\r\n#define\sTHREAD_SEND_CLBK\s1<<3\r\n\r\nBest\sregards,\r\nFrans\svan\sder\sHave,\r\ndeveloper\sat\sScientific\sVolume\sImaging.
J foundin 8.6
J is_private 0
J login fvanderhave
J priority 5\sMedium
J private_contact 77b78217bda604844f1ebd4c005e3cb7fbc8be50
J resolution None
J severity Minor
J status Open
J submitter fvanderhave
J subsystem 80.\sThread\sPackage
J title Missing\sparentheses\sin\s#define\sLABEL\s\s1<<1
J type Bug
K 957dbe231ccd7f311b583ebe47da716db43c0641
U fvanderhave
Z a85291974d4a8df864efab87c929becd