{"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":11,"created_at":"2015-03-02T22:42:42Z","updated_at":"2015-03-06T22:48:38Z","closed_at":null,"body":"With clang-upc on Solaris/x86 and gcc or cc (Sun/Oracle compiler) 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/77650753","html_url":"https://github.com/Intrepid/upc2c/issues/112#issuecomment-77650753","issue_url":"https://api.github.com/repos/Intrepid/upc2c/issues/112","id":77650753,"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-06T22:48:38Z","updated_at":"2015-03-06T22:48:38Z","body":"OK, this is not as simple as expected.\r\nThere is no longer a defn of `_REENTRANT`, and `upc_io.h` is only *indirectly* responsible.\r\nThere is something in (or below) `stdlib.h` that is defining `_POSIX_C_SOURCE` to a value that leads to the thread-safe defn of `errno`  **and** this is happening only on the first pre-process (w/ clang) but not on the second pre-process (with gcc or cc). \r\n\r\n````\r\n$ cat -n test.c\r\n     1  #if defined _REENTRANT\r\n     2    #warning _REENTRANT is defined before stdlib.h\r\n     3  #endif\r\n     4  #if defined _TS_ERRNO\r\n     5    #warning _TS_ERRNOR is defined before stdlib.h\r\n     6  #endif\r\n     7  #if _POSIX_C_SOURCE - 0 >= 199506L\r\n     8    #warning _POSIX_C_SOURCE >= 199506L before stdlib.h\r\n     9  #endif\r\n    10  #include <stdlib.h>\r\n    11  #if defined _REENTRANT\r\n    12    #warning _REENTRANT is defined after stdlib.h\r\n    13  #endif\r\n    14  #if defined _TS_ERRNO\r\n    15    #warning _TS_ERRNOR is defined after stdlib.h\r\n    16  #endif\r\n    17  #if _POSIX_C_SOURCE - 0 >= 199506L\r\n    18    #warning _POSIX_C_SOURCE >= 199506L after stdlib.h\r\n    19  #endif\r\n    20  \r\n    21  #include <errno.h>\r\n    22  #ifdef errno\r\n    23  #warning Errno is now a macro\r\n    24  #endif\r\n\r\n$ clang -c test.c\r\ntest.c:18:4: warning: _POSIX_C_SOURCE >= 199506L after stdlib.h [-W#warnings]\r\n  #warning _POSIX_C_SOURCE >= 199506L after stdlib.h\r\n   ^\r\ntest.c:23:2: warning: Errno is now a macro [-W#warnings]\r\n#warning Errno is now a macro\r\n ^\r\n2 warnings generated.\r\n\r\n$ clang -Wno-#warnings -dM -E test.c | grep _POSIX_C_SOURCE\r\n#define _POSIX_C_SOURCE 200112L\r\n````\r\n\r\nThe `/usr/include/sys/feature_tests.h` header appears to be the most likely spot for the definition - I am looking now."}}