erpc icon indicating copy to clipboard operation
erpc copied to clipboard

Asign value to ptrSize, to avoid maybe-uninitialized warning

Open amgross opened this issue 1 year ago • 2 comments

Pull request

Choose Correct

  • [X] bug
  • [ ] feature

Describe the pull request

Using G++ compiler on windows, I was getting maybe-uninitialized warning on the if (ptrSize > sizeof(*value)). It is correct because read may not read in case that m_status is bad, although in this case the erpc behaviour is OK because also the updateStatus call will be ignored.

To Reproduce

Expected behavior

No compilation warning

Screenshots

Desktop (please complete the following information):

  • OS: Windows
  • eRPC Version:

Steps you didn't forgot to do

  • [X] I checked if other PR isn't solving this issue.
  • [X] I read Contribution details and did appropriate actions.
  • [X] PR code is tested.
  • [X] PR code is formatted.
  • [X] Allow edits from maintainers pull request option is set (recommended).

Additional context

amgross avatar Feb 22 '24 11:02 amgross

@Hadatko Can you check if the tests failure related to me?

BTW, other solution is to check if (isStatusOk() && ptrSize > sizeof(*value))

amgross avatar Feb 22 '24 12:02 amgross

I created this issue related mac build; https://github.com/EmbeddedRPC/erpc/issues/408

Hadatko avatar Feb 22 '24 13:02 Hadatko