You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/24 09:26:54 UTC

[GitHub] [incubator-nuttx] anchao commented on pull request #7409: boards/arm/gcc: disable coverage analysis temporarily

anchao commented on PR #7409:
URL: https://github.com/apache/incubator-nuttx/pull/7409#issuecomment-1288723427

   > Anyway I still think that we are too fast with toolchain upgrade, but I'm more conservative. Do we have a significant gain in optimisation with new compiler? Or what is the rush here?
   
   The new toolchain adds more static analyzer on compile stage, which will helpful for code quality:
   https://gcc.gnu.org/gcc-11/changes.html
   ![img_v2_5edc10d7-b3cb-4363-ac37-4cebf16c548l](https://user-images.githubusercontent.com/758493/197493338-449fdfe6-1324-46e8-8d44-6859a8af9507.png)
   
   For example:
   
   ```
       if (focus != NULL) {
           nxipc_client_disconnect(focus->send_proxy);
           nxipc_sub_disconnect(focus->receive_proxy);
           free((void*)focus->name);
           free((void*)focus);
           pthread_mutex_destroy(&focus->mutex);   <--  use-after-free
       }
   ```
   
   build will break on gcc-11.3  ([-Werror=use-after-free])
   ```
   ../common/src/client/app_focus_c.c: In function 'app_focus_release':
   ../common/src/client/app_focus_c.c:157:9: error: pointer 'handle' used after 'free' [-Werror=use-after-free]
     157 |         pthread_mutex_destroy(&focus->mutex);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ../common/src/client/app_focus_c.c:156:9: note: call to 'free' here
     156 |         free((void*)focus);
         |         ^~~~~~~~~~~~~~~~~~
   
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org