{"action":"created","issue":{"url":"https://api.github.com/repos/relic-toolkit/relic/issues/54","repository_url":"https://api.github.com/repos/relic-toolkit/relic","labels_url":"https://api.github.com/repos/relic-toolkit/relic/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/relic-toolkit/relic/issues/54/comments","events_url":"https://api.github.com/repos/relic-toolkit/relic/issues/54/events","html_url":"https://github.com/relic-toolkit/relic/issues/54","id":259554284,"number":54,"title":"Compiling RELIC with BN_MOD set to PMERS","user":{"login":"alinush","id":1724810,"avatar_url":"https://avatars0.githubusercontent.com/u/1724810?v=4","gravatar_id":"","url":"https://api.github.com/users/alinush","html_url":"https://github.com/alinush","followers_url":"https://api.github.com/users/alinush/followers","following_url":"https://api.github.com/users/alinush/following{/other_user}","gists_url":"https://api.github.com/users/alinush/gists{/gist_id}","starred_url":"https://api.github.com/users/alinush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alinush/subscriptions","organizations_url":"https://api.github.com/users/alinush/orgs","repos_url":"https://api.github.com/users/alinush/repos","events_url":"https://api.github.com/users/alinush/events{/privacy}","received_events_url":"https://api.github.com/users/alinush/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-21T16:19:46Z","updated_at":"2018-03-26T11:31:16Z","closed_at":null,"author_association":"NONE","body":"Hi all,\r\n\r\nI configured RELIC with `DBN_METHD=\"COMBA;COMBA;PMERS;SLIDE;BASIC;BASIC\"` (i.e., `PMERS` rather than `MONTY`) on OS X using XCode's clang:\r\n\r\n```\r\nmkdir build/\r\ncd build/\r\ncmake -DWORD=64 -DRAND=UDEV -DSHLIB=ON -DSTLIB=ON -DSTBIN=OFF -DTIMER=HREAL -DCHECK=on -DVERBS=on -DARITH=x64-asm-254 -DFP_PRIME=254 -DFP_METHD=\"INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE\" -DCOMP=\"-O3 -funroll-loops -fomit-frame-pointer -finline-small-functions -march=native -mtune=native\" -DFP_PMERS=off -DFP_QNRES=on -DFPX_METHD=\"INTEG;INTEG;LAZYR\" -DPP_METHD=\"LAZYR;OATEP\" -DBN_METHD=\"COMBA;COMBA;PMERS;SLIDE;BASIC;BASIC\" ..\r\n```\r\n\r\n...and got the following errors:\r\n\r\n```\r\n[ 88%] Building C object test/CMakeFiles/test_bn.dir/test_bn.c.o\r\nclang: warning: optimization flag '-finline-small-functions' is not supported [-Wignored-optimization-argument]\r\n/Users/alinush/repos/relic/test/test_bn.c:1005:16: warning: incompatible integer to pointer conversion passing 'int' to parameter of type\r\n      'const bn_st *' [-Wint-conversion]\r\n                bn_sub(p, p, 1);\r\n                             ^\r\n/Users/alinush/repos/relic/include/relic_bn.h:740:46: note: passing argument to parameter 'b' here\r\nvoid bn_sub(bn_t c, const bn_t a, const bn_t b);\r\n                                             ^\r\n/Users/alinush/repos/relic/test/test_bn.c:1556:10: error: use of undeclared identifier 'p'\r\n                bn_sub(p, p, 1);\r\n                       ^\r\n/Users/alinush/repos/relic/test/test_bn.c:1556:13: error: use of undeclared identifier 'p'\r\n                bn_sub(p, p, 1);\r\n                          ^\r\n1 warning and 2 errors generated.\r\n```\r\n\r\nThe first warning seems to be because `bn_sub_dig` needs to be called, **not** `bn_sub` since the second argument is a dig_t/integer.\r\n\r\nThe second error seems to be because of a misnamed variable (copy & paste gone wrong?). `p` should be `d` I think.\r\n\r\nThe patch should be:\r\n```\r\ndiff --git a/test/test_bn.c b/test/test_bn.c\r\nindex 75d12915..c170f1cf 100644\r\n--- a/test/test_bn.c\r\n+++ b/test/test_bn.c\r\n@@ -1002,7 +1002,7 @@ static int exponentiation(void) {\r\n \t\t/* Let's try a Mersenne prime. */\r\n \t\tbn_zero(p);\r\n \t\tbn_set_bit(p, 127, 1);\r\n-\t\tbn_sub(p, p, 1);\r\n+\t\tbn_sub_dig(p, p, 1);\r\n #endif\r\n\r\n \t\tTEST_BEGIN(\"modular exponentiation is correct\") {\r\n@@ -1553,7 +1553,7 @@ static int digit(void) {\r\n \t\t/* Let's try a Mersenne prime. */\r\n \t\tbn_zero(d);\r\n \t\tbn_set_bit(d, 127, 1);\r\n-\t\tbn_sub(p, p, 1);\r\n+\t\tbn_sub_dig(d, d, 1);\r\n #endif\r\n\r\n \t\tTEST_BEGIN(\"modular exponentiation with a digit is consistent\") {\r\n```"},"comment":{"url":"https://api.github.com/repos/relic-toolkit/relic/issues/comments/376134858","html_url":"https://github.com/relic-toolkit/relic/issues/54#issuecomment-376134858","issue_url":"https://api.github.com/repos/relic-toolkit/relic/issues/54","id":376134858,"user":{"login":"dfaranha","id":5369810,"avatar_url":"https://avatars1.githubusercontent.com/u/5369810?v=4","gravatar_id":"","url":"https://api.github.com/users/dfaranha","html_url":"https://github.com/dfaranha","followers_url":"https://api.github.com/users/dfaranha/followers","following_url":"https://api.github.com/users/dfaranha/following{/other_user}","gists_url":"https://api.github.com/users/dfaranha/gists{/gist_id}","starred_url":"https://api.github.com/users/dfaranha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfaranha/subscriptions","organizations_url":"https://api.github.com/users/dfaranha/orgs","repos_url":"https://api.github.com/users/dfaranha/repos","events_url":"https://api.github.com/users/dfaranha/events{/privacy}","received_events_url":"https://api.github.com/users/dfaranha/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T11:31:16Z","updated_at":"2018-03-26T11:31:16Z","author_association":"CONTRIBUTOR","body":"Yes, please, thanks! :)"}}
{"actor":{"display_login":"dfaranha"}}