Skip to content

Conversation

@0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Feb 18, 2020

Fixes ARMmbed/mbed-os#12455.

Set local stats array to static to fix issue. It also avoids putting large objects on the stack.

void print_socket_stats()
{
mbed_stats_socket_t stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT] = {0};
static mbed_stats_socket_t stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is arguably better anyway - should probably avoid putting potentially-large objects on the stack in case of overflow.

Although on the other hand this is just a temporary for the print, so if there was no overflow danger, automatic is good.

If wanting to keep automatic, a better (C++11 or later) syntax to zero-init than = { 0 } is just {} (no =). That is probably simpler for the compiler, and could also avoid the bug.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the assertion failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cryptic error:

[DEBUG] Return: 3
[DEBUG] Output: Internal error: [Front end]: assertion failed at: "/home/jenkins_ci01/slave_top/workspace/ArmReleaseBuild/core/translator/compiler_core/src/parser/edg/il.c", line 23626

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tested mbed_stats_socket_t stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT] {}; , errors as well

Set local `stats` array to static to fix issue
ARMmbed/mbed-os#12455.
It also avoids putting large objects on the stack.
@hugueskamba hugueskamba changed the title set stats to static Fix IAR build failure Feb 18, 2020
@evedon evedon merged commit 8e59b10 into master Feb 18, 2020
@0xc0170 0xc0170 deleted the fix_iar_error branch February 18, 2020 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nightly/PRs: IAR build errors with an internal error

4 participants