Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

test: astlpc: fix compile warning #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

williamspatrick
Copy link

With the GCC found in openbmc/openbmc master, we are observing the
following:

    | build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:98:26: error: array subscript 2 is above array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds]
    |    98 |                 mmio->kcs[reg] = val;
    |       |                 ~~~~~~~~~^~~~~
    | build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:63:17: note: while referencing 'kcs'
    |    63 |         uint8_t kcs[2];

Fix this by being explicit about the register access (enum to int map).

With the GCC found in openbmc/openbmc master, we are observing the
following:

```
    | build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:98:26: error: array subscript 2 is above array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds]
    |    98 |                 mmio->kcs[reg] = val;
    |       |                 ~~~~~~~~~^~~~~
    | build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:63:17: note: while referencing 'kcs'
    |    63 |         uint8_t kcs[2];
```

Fix this by being explicit about the register access (enum to int map).
facebook-github-bot pushed a commit to facebook/openbmc that referenced this pull request Jun 14, 2022
Summary:
The current revision of code upstream in this repository
appears to fail to compile with later versions of GCC.  Fix them.

```
| build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:98:26: error: array subscript 2 is above array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds]
|    98 |                 mmio->kcs[reg] = val;
|       |                 ~~~~~~~~~^~~~~
| build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:63:17: note: while referencing 'kcs'
|    63 |         uint8_t kcs[2];
```

Submitted upstream at Intel-BMC/libmctp#1

Test Plan: Build passes.

Reviewed By: GoldenBug

fbshipit-source-id: d48d3c787bccea767d29de8879c72ac93e20961f
@williamspatrick
Copy link
Author

@sumbhat90 - Is there any hope to get this PR merged? It has been open since June 2022 with no comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant