<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dangling pointer warnings building NRF Connect SDK with ARM GCC 13.2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107912/dangling-pointer-warnings-building-nrf-connect-sdk-with-arm-gcc-13-2</link><description>GCC v13.2 emits the following warnings when compiling NRF Connect SDK. Starting in GCC 13 a new warning (-Wdangling-pointer) is enabled automatically when -Wall is selected.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 02 Feb 2024 08:15:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107912/dangling-pointer-warnings-building-nrf-connect-sdk-with-arm-gcc-13-2" /><item><title>RE: Dangling pointer warnings building NRF Connect SDK with ARM GCC 13.2</title><link>https://devzone.nordicsemi.com/thread/467299?ContentTypeID=1</link><pubDate>Fri, 02 Feb 2024 08:15:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98c5f617-9555-4b9d-9cf7-f89e6a33b43c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="dpalchak-google"]Yeah, just warning needed to be suppressed. Thanks![/quote]
&lt;p&gt;Again; I should be thanking you for making us aware of the issue. It is highly appreciated!&lt;/p&gt;
&lt;p&gt;The PR is now merged, and future versions of NCS will have the warning ignored for the code snippet in question.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope you have a wonderful weekend when that time comes!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dangling pointer warnings building NRF Connect SDK with ARM GCC 13.2</title><link>https://devzone.nordicsemi.com/thread/467238?ContentTypeID=1</link><pubDate>Thu, 01 Feb 2024 17:44:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4b11594-3672-4f6b-803f-ea075b9207e1</guid><dc:creator>David Palchak</dc:creator><description>&lt;p&gt;Yeah, just warning needed to be suppressed. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dangling pointer warnings building NRF Connect SDK with ARM GCC 13.2</title><link>https://devzone.nordicsemi.com/thread/467080?ContentTypeID=1</link><pubDate>Thu, 01 Feb 2024 08:58:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24a431f2-e362-4241-83ef-127b048b3083</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Replying to myself here.&lt;/p&gt;
&lt;p&gt;It does indeed look suspicions at first glance (I also believed so), but after discussing this with the developer who wrote the code initially, it is always removed from the list within the same scope.&lt;/p&gt;
&lt;p&gt;The code (taken from here&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/lib/nrf_modem_lib/nrf_modem_os.c#L177-L183"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/lib/nrf_modem_lib/nrf_modem_os.c#L177-L183&lt;/a&gt;) is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    struct sleeping_thread thread;
    
    ...
    
	if (!sleeping_thread_add(&amp;amp;thread)) {
		return 0;
	}

	(void)k_sem_take(&amp;amp;thread.sem, SYS_TIMEOUT_MS(*timeout));

	sleeping_thread_remove(&amp;amp;thread);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Each thread (or socket actually in the scope of nRF91-series) that enters here will allocate a dedicated sleeping_thread var, which will await until it is awoken again before removing it from the slist entry.&lt;/p&gt;
&lt;p&gt;Making &amp;quot;thread&amp;quot; static would break the reentrancy of the function itself, allowing for only one network socket to be sleeping at the time.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We will look into pushing a pragma to disable the -Wdangling-pointer warning for this specific scope, with a proper comment explaining why.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;*edit* Here&amp;#39;s the proposed PR:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/13830"&gt;https://github.com/nrfconnect/sdk-nrf/pull/13830&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dangling pointer warnings building NRF Connect SDK with ARM GCC 13.2</title><link>https://devzone.nordicsemi.com/thread/467061?ContentTypeID=1</link><pubDate>Thu, 01 Feb 2024 08:04:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f30997e3-940e-477c-b11e-4f4ec8779ee3</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for reporting this back to us, and helping up improve upon our delivery!&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll&amp;nbsp;will report this back to our nRF91 team.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>