{"action":"created","issue":{"url":"https://api.github.com/repos/cisco/ChezScheme/issues/1","repository_url":"https://api.github.com/repos/cisco/ChezScheme","labels_url":"https://api.github.com/repos/cisco/ChezScheme/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/cisco/ChezScheme/issues/1/comments","events_url":"https://api.github.com/repos/cisco/ChezScheme/issues/1/events","html_url":"https://github.com/cisco/ChezScheme/issues/1","id":151170985,"number":1,"title":"FIX(-1) fails on gcc 6.0.0","user":{"login":"johnwcowan","id":1767302,"avatar_url":"https://avatars.githubusercontent.com/u/1767302?v=3","gravatar_id":"","url":"https://api.github.com/users/johnwcowan","html_url":"https://github.com/johnwcowan","followers_url":"https://api.github.com/users/johnwcowan/followers","following_url":"https://api.github.com/users/johnwcowan/following{/other_user}","gists_url":"https://api.github.com/users/johnwcowan/gists{/gist_id}","starred_url":"https://api.github.com/users/johnwcowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnwcowan/subscriptions","organizations_url":"https://api.github.com/users/johnwcowan/orgs","repos_url":"https://api.github.com/users/johnwcowan/repos","events_url":"https://api.github.com/users/johnwcowan/events{/privacy}","received_events_url":"https://api.github.com/users/johnwcowan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-26T15:49:19Z","updated_at":"2016-04-26T19:10:12Z","closed_at":null,"body":"Left shifting a negative number is undefined behavior in C.  gcc 6.0.0 on x86_64 Linux prints a warning for this, even though all sane machines do the Right Thing.  -Werror promotes this warning to an error, so the build fails.\r\n\r\nI patched around this by simply removing -Werror from the Mk* files.  However, recent C compilers take undefined behavior as a license to miscompile things, so the FIX macro needs to be improved to do the necessary casts to unsigned and back.  Here's an example of miscompiling:\r\n\r\n```\r\nuint32_t shiftleft(uint32_t v, uint8_t n)\r\n{\r\n  if (n >= 32)\r\n    v=0;\r\n  return v<<n;\r\n}\r\n```\r\n\r\nmay wind up being compiled without the `if` statement, because it assumes that `n >= 32` can never be true, since if it were true it would lead to undefined behavior."},"comment":{"url":"https://api.github.com/repos/cisco/ChezScheme/issues/comments/214853289","html_url":"https://github.com/cisco/ChezScheme/issues/1#issuecomment-214853289","issue_url":"https://api.github.com/repos/cisco/ChezScheme/issues/1","id":214853289,"user":{"login":"jonathanyc","id":360412,"avatar_url":"https://avatars.githubusercontent.com/u/360412?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanyc","html_url":"https://github.com/jonathanyc","followers_url":"https://api.github.com/users/jonathanyc/followers","following_url":"https://api.github.com/users/jonathanyc/following{/other_user}","gists_url":"https://api.github.com/users/jonathanyc/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanyc/subscriptions","organizations_url":"https://api.github.com/users/jonathanyc/orgs","repos_url":"https://api.github.com/users/jonathanyc/repos","events_url":"https://api.github.com/users/jonathanyc/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanyc/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T19:10:11Z","updated_at":"2016-04-26T19:10:11Z","body":"@dybvig Thanks so much for releasing the source! Would something like this fix the issue?\r\n\r\n```diff\r\ndiff --git a/boot/a6osx/scheme.h b/boot/a6osx/scheme.h\r\nindex c97296a..4d72379 100644\r\n--- a/boot/a6osx/scheme.h\r\n+++ b/boot/a6osx/scheme.h\r\n@@ -127,7 +127,7 @@ EXPORT void Sset_cdr PROTO((ptr, ptr));\r\n EXPORT void Svector_set PROTO((ptr, iptr, ptr));\r\n \r\n /* Constructors */\r\n-#define Sfixnum(x) ((ptr)(uptr)((x)<<3))\r\n+#define Sfixnum(x) ((ptr)((uptr)(x)<<3))\r\n #define Schar(x) ((ptr)(uptr)((x)<<8|0x16))\r\n #define Snil ((ptr)0x26)\r\n #define Strue ((ptr)0xE)\r\ndiff --git a/c/prim5.c b/c/prim5.c\r\nindex c4d1031..2184456 100644\r\n--- a/c/prim5.c\r\n+++ b/c/prim5.c\r\n@@ -1686,8 +1686,8 @@ static void s_test_schlib() {\r\n   INT test = 0;\r\n   I32 n1 = 0x73215609;\r\n   I64 n2 = n1 * 37;\r\n-  I32 n3 = (I32)-1<<31;\r\n-  I64 n4 = (I64)-1<<63;\r\n+  I32 n3 = (U32)-1<<31;\r\n+  I64 n4 = (U64)-1<<63;\r\n   I32 n5 = -1;\r\n \r\n   SCHLIBTEST(Sinteger_value(Sinteger(n1)) == n1)\r\n```"}}