)]}'
{"id":"openocd~master~Id3c7dcccb65106e28be200b9a4d2b642f4d31019","project":"openocd","branch":"master","hashtags":[],"change_id":"Id3c7dcccb65106e28be200b9a4d2b642f4d31019","subject":"target/armv7m: fix static analyzer warning","status":"MERGED","created":"2021-05-16 08:19:58.000000000","updated":"2021-05-18 08:03:28.000000000","submitted":"2021-05-18 08:03:28.000000000","submitter":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"total_comment_count":1,"unresolved_comment_count":0,"has_review_started":true,"submission_id":"6256-1621325008465-cc8d14d5","meta_rev_id":"d2014707078239a0596525207eabb3a881c5df31","_number":6256,"owner":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"actions":{},"labels":{"Verified":{"approved":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"all":[{"value":0,"_account_id":1001874,"name":"Andrzej Sierżęga","email":"asier70@gmail.com","username":"asier70"},{"value":0,"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},{"value":0,"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},{"value":0,"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},{"value":1,"date":"2021-05-18 08:03:28.000000000","permitted_voting_range":{"min":1,"max":1},"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]}],"values":{"-1":"Fails"," 0":"No score","+1":"Verified"},"description":"","default_value":0},"Code-Review":{"approved":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"all":[{"value":1,"date":"2021-05-18 08:03:28.000000000","permitted_voting_range":{"min":1,"max":1},"_account_id":1001874,"name":"Andrzej Sierżęga","email":"asier70@gmail.com","username":"asier70"},{"value":1,"date":"2021-05-18 08:03:28.000000000","permitted_voting_range":{"min":1,"max":2},"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},{"value":2,"date":"2021-05-18 08:03:28.000000000","permitted_voting_range":{"min":2,"max":2},"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},{"value":1,"date":"2021-05-18 08:03:28.000000000","permitted_voting_range":{"min":1,"max":1},"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},{"value":0,"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]}],"values":{"-2":"This shall not be merged","-1":"I would prefer this is not merged as is"," 0":"No score","+1":"Looks good to me, but someone else must approve","+2":"Looks good to me, approved"},"description":"","default_value":0}},"removable_reviewers":[],"reviewers":{"REVIEWER":[{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},{"_account_id":1001874,"name":"Andrzej Sierżęga","email":"asier70@gmail.com","username":"asier70"}]},"pending_reviewers":{},"reviewer_updates":[{"updated":"2021-05-17 16:35:33.000000000","updated_by":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"reviewer":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"state":"REVIEWER"},{"updated":"2021-05-17 16:51:37.000000000","updated_by":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"reviewer":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"state":"REVIEWER"},{"updated":"2021-05-17 17:46:03.000000000","updated_by":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"reviewer":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"state":"REVIEWER"},{"updated":"2021-05-18 08:00:03.000000000","updated_by":{"_account_id":1001874,"name":"Andrzej Sierżęga","email":"asier70@gmail.com","username":"asier70"},"reviewer":{"_account_id":1001874,"name":"Andrzej Sierżęga","email":"asier70@gmail.com","username":"asier70"},"state":"REVIEWER"}],"messages":[{"id":"e117e32a468d7d284e95f917f69ea956c06a8d79","author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"real_author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"date":"2021-05-16 08:19:58.000000000","message":"Uploaded patch set 1.","accounts_in_message":[],"_revision_number":1},{"id":"d56f8af38ea298800726ba3b0bf9c2347129ae89","author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"real_author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"date":"2021-05-16 08:49:44.000000000","message":"Patch Set 1: Verified+1\n\nBuild Successful \n\nhttp://build.openocd.org/job/openocd-gerrit/14562/ : SUCCESS\n\nhttp://build.openocd.org/job/openocd-gerrit-build/13814/ : SUCCESS","accounts_in_message":[],"_revision_number":1},{"id":"e8d0a8bba150b00c27f8797cac158066a0f3574a","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2021-05-16 09:14:11.000000000","message":"Patch Set 1:\n\n(1 comment)","accounts_in_message":[],"_revision_number":1},{"id":"b75935f7167ebd2a02c4edf4b48d8396187acca5","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2021-05-16 09:57:12.000000000","message":"Patch Set 1:\n\nthe problem with mingw32 is that it defines assert() without the attribute \"noreturn\", whatever NDEBUG defined or not.\nSo assert() cannot be used to silent the static analyzer.\nPlus, I\u0027m not sure we should rely on assert() to quit on error; better having other types of check.","accounts_in_message":[],"_revision_number":1},{"id":"ac02321bc211434118df7f103960094e0a851baf","author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"real_author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"date":"2021-05-17 16:04:42.000000000","message":"Uploaded patch set 2.","accounts_in_message":[],"_revision_number":2},{"id":"5911113e8540a64686501ba7559657226f9249a0","author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"real_author":{"_account_id":1000014,"name":"jenkins","username":"jenkins","tags":["SERVICE_USER"]},"date":"2021-05-17 16:35:33.000000000","message":"Patch Set 2: Verified+1\n\nBuild Successful \n\nhttp://build.openocd.org/job/openocd-gerrit/14572/ : SUCCESS\n\nhttp://build.openocd.org/job/openocd-gerrit-build/13824/ : SUCCESS","accounts_in_message":[],"_revision_number":2},{"id":"de5a06046076bc01aba879392d2cb7ace25d0e6f","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2021-05-17 16:51:37.000000000","message":"Patch Set 2: Code-Review+1","accounts_in_message":[],"_revision_number":2},{"id":"e92cae5781ebe9d079f80ca599d6d9f1886f3f09","author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"real_author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"date":"2021-05-17 16:59:50.000000000","message":"Patch Set 2:\n\n\u003e ...but this extra level of indentation is ugly.\n\nYou\u0027re right, I didn\u0027t like it as well. Error return helps.\n\n \u003e ... whatever NDEBUG defined or not.\n\nDoes anybody compile with NDEBUG? Is it used by some packagers?\n\n \u003e So assert() cannot be used to silent the static analyzer.\n \u003e Plus, I\u0027m not sure we should rely on assert() to quit on error;\n \u003e better having other types of check.\n\nWell the programmer\u0027s error is the only which can and IMO should\nbe treated by assert(). In this case the assert() would trigger if somebody screwed up register description tables.\nOf course we can LOG_ERROR(\"Internal error: blah blah\")\nand we should hope that the message is not missed by the author of\na future change.","accounts_in_message":[],"_revision_number":2},{"id":"23de2a4f6d4a818e12e4294e594480e92d1c022d","author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"real_author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"date":"2021-05-17 17:01:04.000000000","message":"Patch Set 2: Code-Review+2\n\nI\u0027ll merge it fast to fix mingw compilation","accounts_in_message":[],"_revision_number":2},{"id":"ac4f7498e15d90d82c3b7e817efdf8457aaad77d","author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"real_author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"date":"2021-05-17 17:40:26.000000000","message":"Patch Set 2:\n\n\u003e Does anybody compile with NDEBUG? Is it used by some packagers?\n\nDon\u0027t know!\nThe manpage of assert say:\n\n \u003e If the macro NDEBUG is defined at the moment \u003cassert.h\u003e was last included,\n \u003e the macro assert() generates no code, and hence does nothing at all. It is\n \u003e not recommended to define NDEBUG if using assert() to detect error\n \u003e conditions since the software may behave non-deterministically.\n\nI vaguely remember some library using assert to validate all the parameters passed to each function, then the release has NDEBUG set to reduce the overhead. I think it was for some safety compliance.","accounts_in_message":[],"_revision_number":2},{"id":"6184fa995c4630adcd5a598c26a7efb47ac8ba40","author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"real_author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"date":"2021-05-17 17:46:03.000000000","message":"Patch Set 2: Code-Review+1\n\nchecked OK using gcc version 9.3-win32 20200320 (GCC)","accounts_in_message":[],"_revision_number":2},{"id":"c3cea8919e65c4ce6cfbb37def81fd05dd884472","author":{"_account_id":1001874,"name":"Andrzej Sierżęga","email":"asier70@gmail.com","username":"asier70"},"real_author":{"_account_id":1001874,"name":"Andrzej Sierżęga","email":"asier70@gmail.com","username":"asier70"},"date":"2021-05-18 08:00:03.000000000","message":"Patch Set 2: Code-Review+1\n\nTested using x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200320 - cross compile with Ubuntu on Windows 10. Patch solves the problem.","accounts_in_message":[],"_revision_number":2},{"id":"d2014707078239a0596525207eabb3a881c5df31","author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"real_author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"date":"2021-05-18 08:03:28.000000000","message":"Change has been successfully cherry-picked as d7558e2ed67000afc2fa344e3acf67899fc3cebf by Tomas Vanek","accounts_in_message":[],"_revision_number":3}],"current_revision":"d7558e2ed67000afc2fa344e3acf67899fc3cebf","revisions":{"d7558e2ed67000afc2fa344e3acf67899fc3cebf":{"kind":"NO_CODE_CHANGE","_number":3,"created":"2021-05-18 08:03:28.000000000","uploader":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"ref":"refs/changes/56/6256/3","fetch":{"anonymous http":{"url":"https://review.openocd.org/openocd","ref":"refs/changes/56/6256/3","commands":{"Branch":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/3 \u0026\u0026 git checkout -b change-6256 FETCH_HEAD","Checkout":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/3 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/3 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/3 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.openocd.org/openocd refs/changes/56/6256/3","Reset To":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/3 \u0026\u0026 git reset --hard FETCH_HEAD"}}},"commit":{"parents":[{"commit":"bbbfddc3efd4a93b0c9489c2537efbaa117bcfb0","subject":"jimtcl: restrict memory leak workaround on Linux only"}],"author":{"name":"Tomas Vanek","email":"vanekt@fbl.cz","date":"2021-05-16 08:05:02.000000000","tz":120},"committer":{"name":"Tomas Vanek","email":"vanekt@fbl.cz","date":"2021-05-18 08:03:28.000000000","tz":60},"subject":"target/armv7m: fix static analyzer warning","message":"target/armv7m: fix static analyzer warning\n\nDespite of assert(is_packed) clang static analyser complains on use\nof the uninitialized offset variable.\n\nCross compiling with latest x86_64-w64-mingw32-gcc hits warnings\n\tsrc/target/armv7m.c: In function ‘armv7m_read_core_reg’:\n\tsrc/target/armv7m.c:337:54: error: ‘reg32_id’ may be used\n\t    uninitialized in this function [-Werror\u003dmaybe-uninitialized]\n\nIt happens because mingw32 defines assert() without the attribute\n\"noreturn\", whatever NDEBUG is defined or not.\n\nReplace assert(is_packed) by if (is_packed) conditional and call\nassert(false) in the else branch.\n\nChange-Id: Id3c7dcccb65106e28be200b9a4d2b642f4d31019\nSigned-off-by: Tomas Vanek \u003cvanekt@fbl.cz\u003e\nReviewed-on: http://openocd.zylin.com/6256\nTested-by: jenkins\nReviewed-by: Antonio Borneo \u003cborneo.antonio@gmail.com\u003e\nReviewed-by: Tarek BOCHKATI \u003ctarek.bouchkati@gmail.com\u003e\nReviewed-by: Andrzej Sierżęga \u003casier70@gmail.com\u003e\n"}},"31653ebd7fc9dcb8e4f5b22bb6492692e3b76932":{"kind":"REWORK","_number":2,"created":"2021-05-17 16:04:42.000000000","uploader":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"ref":"refs/changes/56/6256/2","fetch":{"anonymous http":{"url":"https://review.openocd.org/openocd","ref":"refs/changes/56/6256/2","commands":{"Branch":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/2 \u0026\u0026 git checkout -b change-6256 FETCH_HEAD","Checkout":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/2 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/2 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/2 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.openocd.org/openocd refs/changes/56/6256/2","Reset To":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/2 \u0026\u0026 git reset --hard FETCH_HEAD"}}},"commit":{"parents":[{"commit":"bbbfddc3efd4a93b0c9489c2537efbaa117bcfb0","subject":"jimtcl: restrict memory leak workaround on Linux only"}],"author":{"name":"Tomas Vanek","email":"vanekt@fbl.cz","date":"2021-05-16 08:05:02.000000000","tz":120},"committer":{"name":"Tomas Vanek","email":"vanekt@fbl.cz","date":"2021-05-17 16:03:48.000000000","tz":120},"subject":"target/armv7m: fix static analyzer warning","message":"target/armv7m: fix static analyzer warning\n\nDespite of assert(is_packed) clang static analyser complains on use\nof the uninitialized offset variable.\n\nCross compiling with latest x86_64-w64-mingw32-gcc hits warnings\n\tsrc/target/armv7m.c: In function ‘armv7m_read_core_reg’:\n\tsrc/target/armv7m.c:337:54: error: ‘reg32_id’ may be used\n\t    uninitialized in this function [-Werror\u003dmaybe-uninitialized]\n\nIt happens because mingw32 defines assert() without the attribute\n\"noreturn\", whatever NDEBUG is defined or not.\n\nReplace assert(is_packed) by if (is_packed) conditional and call\nassert(false) in the else branch.\n\nChange-Id: Id3c7dcccb65106e28be200b9a4d2b642f4d31019\nSigned-off-by: Tomas Vanek \u003cvanekt@fbl.cz\u003e\n"}},"47da610fd0970dd8dfdeb1c25d33fcb48106e4f1":{"kind":"REWORK","_number":1,"created":"2021-05-16 08:19:58.000000000","uploader":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"ref":"refs/changes/56/6256/1","fetch":{"anonymous http":{"url":"https://review.openocd.org/openocd","ref":"refs/changes/56/6256/1","commands":{"Branch":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/1 \u0026\u0026 git checkout -b change-6256 FETCH_HEAD","Checkout":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/1 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/1 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.openocd.org/openocd refs/changes/56/6256/1","Reset To":"git fetch https://review.openocd.org/openocd refs/changes/56/6256/1 \u0026\u0026 git reset --hard FETCH_HEAD"}}},"commit":{"parents":[{"commit":"bbbfddc3efd4a93b0c9489c2537efbaa117bcfb0","subject":"jimtcl: restrict memory leak workaround on Linux only"}],"author":{"name":"Tomas Vanek","email":"vanekt@fbl.cz","date":"2021-05-16 08:05:02.000000000","tz":120},"committer":{"name":"Tomas Vanek","email":"vanekt@fbl.cz","date":"2021-05-16 08:17:57.000000000","tz":120},"subject":"target/armv7m: fix static analyzer warning","message":"target/armv7m: fix static analyzer warning\n\nDespite of assert(is_packed) clang static analyzer complains on use\nof the uninitialized offset variable.\n\nCross compiling with latest x86_64-w64-mingw32-gcc hits warnings\n\tsrc/target/armv7m.c: In function ‘armv7m_read_core_reg’:\n\tsrc/target/armv7m.c:337:54: error: ‘reg32_id’ may be used\n\t    uninitialized in this function [-Werror\u003dmaybe-uninitialized]\n\nIt looks like static analysis does not understand assert() function.\nReplace assert(is_packed) by if (is_packed) conditional and call assert(false)\nin the else branch.\n\nChange-Id: Id3c7dcccb65106e28be200b9a4d2b642f4d31019\nSigned-off-by: Tomas Vanek \u003cvanekt@fbl.cz\u003e\n"}}},"requirements":[],"submit_records":[],"submit_requirements":[]}
