{"action":"created","issue":{"url":"https://api.github.com/repos/briansmith/ring/issues/150","repository_url":"https://api.github.com/repos/briansmith/ring","labels_url":"https://api.github.com/repos/briansmith/ring/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/briansmith/ring/issues/150/comments","events_url":"https://api.github.com/repos/briansmith/ring/issues/150/events","html_url":"https://github.com/briansmith/ring/issues/150","id":140420601,"number":150,"title":"Fix char*/unsigned char*/int8_t*/uint8_t* casting","user":{"login":"briansmith","id":16816,"avatar_url":"https://avatars.githubusercontent.com/u/16816?v=3","gravatar_id":"","url":"https://api.github.com/users/briansmith","html_url":"https://github.com/briansmith","followers_url":"https://api.github.com/users/briansmith/followers","following_url":"https://api.github.com/users/briansmith/following{/other_user}","gists_url":"https://api.github.com/users/briansmith/gists{/gist_id}","starred_url":"https://api.github.com/users/briansmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansmith/subscriptions","organizations_url":"https://api.github.com/users/briansmith/orgs","repos_url":"https://api.github.com/users/briansmith/repos","events_url":"https://api.github.com/users/briansmith/events{/privacy}","received_events_url":"https://api.github.com/users/briansmith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/briansmith/ring/labels/static-analysis-and-type-safety","name":"static-analysis-and-type-safety","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-12T22:00:53Z","updated_at":"2016-03-12T22:02:19Z","closed_at":null,"body":"@regehr brought to attention something that @ch3root pointed out: `int8_t` isn't necessarily `char` and `uint8_t` isn't necessarily `unsigned char`. The exceptional case in the C11 effective type rules is only for “character types.” Thus, we should never be casting to `uint8_t` or `int8_t`.\r\n\r\nWe do such casts currently, for example, in `rsaz_exp.c` and a few places in gcm.c. And probably other places.\r\n\r\nI think this should be done in three steps:\r\n1. Finish the work on removing unnecessary casts—hopefully all casts, or at least all pointer casts—in *ring*.\r\n2. If there are any remaining casts where this issue is relevant, define a new type `aliasing_uint8` as `unsigned char` and statically assert that it is an 8-bit type. I guess this means statically asserting that CHAR_MAX is 255 and maybe some other stuff.\r\n3. Document this issue in the style/review guide.\r\n\r\nThe reference for this is this ancient email to the GCC mailing list: https://gcc.gnu.org/ml/gcc/2000-05/msg01106.html\r\n"},"comment":{"url":"https://api.github.com/repos/briansmith/ring/issues/comments/195816885","html_url":"https://github.com/briansmith/ring/issues/150#issuecomment-195816885","issue_url":"https://api.github.com/repos/briansmith/ring/issues/150","id":195816885,"user":{"login":"regehr","id":732536,"avatar_url":"https://avatars.githubusercontent.com/u/732536?v=3","gravatar_id":"","url":"https://api.github.com/users/regehr","html_url":"https://github.com/regehr","followers_url":"https://api.github.com/users/regehr/followers","following_url":"https://api.github.com/users/regehr/following{/other_user}","gists_url":"https://api.github.com/users/regehr/gists{/gist_id}","starred_url":"https://api.github.com/users/regehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/regehr/subscriptions","organizations_url":"https://api.github.com/users/regehr/orgs","repos_url":"https://api.github.com/users/regehr/repos","events_url":"https://api.github.com/users/regehr/events{/privacy}","received_events_url":"https://api.github.com/users/regehr/received_events","type":"User","site_admin":false},"created_at":"2016-03-12T22:02:19Z","updated_at":"2016-03-12T22:02:19Z","body":"Also see:\r\nhttps://gcc.gnu.org/bugzilla/show_bug.cgi?id=66110\r\n"}}