{"action":"created","issue":{"url":"https://api.github.com/repos/Intrepid/upc2c/issues/112","labels_url":"https://api.github.com/repos/Intrepid/upc2c/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/Intrepid/upc2c/issues/112/comments","events_url":"https://api.github.com/repos/Intrepid/upc2c/issues/112/events","html_url":"https://github.com/Intrepid/upc2c/issues/112","id":59564121,"number":112,"title":"Problems w/ ___errno on Solaris","user":{"login":"PHHargrove","id":6687992,"avatar_url":"https://avatars.githubusercontent.com/u/6687992?v=3","gravatar_id":"","url":"https://api.github.com/users/PHHargrove","html_url":"https://github.com/PHHargrove","followers_url":"https://api.github.com/users/PHHargrove/followers","following_url":"https://api.github.com/users/PHHargrove/following{/other_user}","gists_url":"https://api.github.com/users/PHHargrove/gists{/gist_id}","starred_url":"https://api.github.com/users/PHHargrove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PHHargrove/subscriptions","organizations_url":"https://api.github.com/users/PHHargrove/orgs","repos_url":"https://api.github.com/users/PHHargrove/repos","events_url":"https://api.github.com/users/PHHargrove/events{/privacy}","received_events_url":"https://api.github.com/users/PHHargrove/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"PHHargrove","id":6687992,"avatar_url":"https://avatars.githubusercontent.com/u/6687992?v=3","gravatar_id":"","url":"https://api.github.com/users/PHHargrove","html_url":"https://github.com/PHHargrove","followers_url":"https://api.github.com/users/PHHargrove/followers","following_url":"https://api.github.com/users/PHHargrove/following{/other_user}","gists_url":"https://api.github.com/users/PHHargrove/gists{/gist_id}","starred_url":"https://api.github.com/users/PHHargrove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PHHargrove/subscriptions","organizations_url":"https://api.github.com/users/PHHargrove/orgs","repos_url":"https://api.github.com/users/PHHargrove/repos","events_url":"https://api.github.com/users/PHHargrove/events{/privacy}","received_events_url":"https://api.github.com/users/PHHargrove/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-03-02T22:42:42Z","updated_at":"2015-03-02T23:08:31Z","closed_at":null,"body":"With clang-upc on Solaris/x86 and gcc or clang as the back-end compiler, I see failures on `upc_io_test.upc`:\r\n````\r\n[benchmarks/upc_io_test] FAILED: UPC-To-C Translation or Link error     (NEW)\r\ncd /shared/upcnightly-32/cupc2c/work/dbg/upc-tests/benchmarks\r\n/export/home/phargrov/upcnightly-32/cupc2c/runtime/inst/bin/upcc -Ww,-Wno-duplicate-decl-specifier -Ww,-Werror=pointer-arith -g  -network=smp  -o upc_io_test upc_io_test.upc\r\nupcc: error compiling translated C code:\r\nupc_io_test.upc: In function 'doit':\r\nupc_io_test.upc:200:13: warning: implicit declaration of function '___errno'\r\nupc_io_test.upc:200:13: warning: nested extern declaration of '___errno' \r\nupc_io_test.upc:200:14: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:205:175: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:205:198: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:207:211: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:207:234: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:207:179: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:207:202: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:207:26: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:208:229: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:208:252: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:208:181: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:208:204: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:208:26: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:228: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:251: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:223: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:246: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:34: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:218: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:241: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:351: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:374: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:197: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:220: error: invalid type argument of unary '*' (have 'int')\r\nupc_io_test.upc:232:26: error: invalid type argument of unary '*' (have 'int')\r\n[... and LOTS more...]\r\n````\r\n\r\nThe problem stems from the following in `/usr/include/errno.h`:\r\n````\r\n#if defined(_REENTRANT) || defined(_TS_ERRNO) || _POSIX_C_SOURCE - 0 >= 199506L\r\nextern int *___errno();\r\n#define errno (*(___errno()))\r\n#else\r\nextern int errno;\r\n/* ANSI C++ requires that errno be a macro */\r\n#if __cplusplus >= 199711L\r\n#define errno errno\r\n#endif\r\n#endif  /* defined(_REENTRANT) || defined(_TS_ERRNO) */\r\n````\r\n\r\nIt appears that clang (and thus clang-upc2c) defines `_REENTRANT` on Solaris, leading to incompatible differences between the first and second pre-process with respect tothe handling of `errno`.\r\n\r\nThis is *odd* because clang does not appear to unconditionally pre-define `_REENTRANT` on Linux, Darwin, FreeBSD, NetBSD or OpenBSD.  Additionally, neither the vendor compiler nor gcc on Solaris are predefining it.  So, this might simply by a side-effect of something that is already a \"bug\". "},"comment":{"url":"https://api.github.com/repos/Intrepid/upc2c/issues/comments/76847528","html_url":"https://github.com/Intrepid/upc2c/issues/112#issuecomment-76847528","issue_url":"https://api.github.com/repos/Intrepid/upc2c/issues/112","id":76847528,"user":{"login":"PHHargrove","id":6687992,"avatar_url":"https://avatars.githubusercontent.com/u/6687992?v=3","gravatar_id":"","url":"https://api.github.com/users/PHHargrove","html_url":"https://github.com/PHHargrove","followers_url":"https://api.github.com/users/PHHargrove/followers","following_url":"https://api.github.com/users/PHHargrove/following{/other_user}","gists_url":"https://api.github.com/users/PHHargrove/gists{/gist_id}","starred_url":"https://api.github.com/users/PHHargrove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PHHargrove/subscriptions","organizations_url":"https://api.github.com/users/PHHargrove/orgs","repos_url":"https://api.github.com/users/PHHargrove/repos","events_url":"https://api.github.com/users/PHHargrove/events{/privacy}","received_events_url":"https://api.github.com/users/PHHargrove/received_events","type":"User","site_admin":false},"created_at":"2015-03-02T23:08:31Z","updated_at":"2015-03-02T23:08:31Z","body":"This issue is (of course) not present with \"-pthreads\" since then `_REENTRANT` is defined consistently.\r\n\r\nLooking deeper, the problem is only with \"-network=smp\" or \"udp\", but not \"ibv\".\r\nThis is true only because ibv-conduit is adding `-D_REENTRANT` to the backend compiler flags.\r\nSimilarly passing `-Wc,-D_REENTRANT` works for any network.  \r\n\r\nWhile sticking with `-network=smp`, compiling with `-U_REENTRANT` or `-Wp,-U_REENTRANT` do not work.  Since passing `-U_REENTRANT` to the pre-process step (using `-Wp,`) did *not* work, I am uncertain as to how we might fix this issue properly.  Clang-upc2c appears to be defining this despite a command-line argument to UNdefine it.\r\n\r\nFor the record, compiling the following confirms that it is only `_REENTRANT` that is leading to the errno definition:\r\n````\r\n#if defined(_TS_ERRNO) || _POSIX_C_SOURCE - 0 >= 199506L\r\n  #error Not the fault of _REENTRANT\r\n#endif\r\n````"}}