Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interpreters/bas: Fix compiler warning after gcc upgrade to version 12 #2225

Merged
merged 1 commit into from
Dec 10, 2023

Conversation

xiaoxiang781216
Copy link
Contributor

Summary

bas_token.l: In function 'yylex':
Error: bas_token.l:1210:31: error: 'strcpy' writing 1 or more bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
 1210 |                             }
      |                               ^
In file included from bas_auto.h:77,
                 from bas_token.l:16:
bas_token.h:103:8: note: at offset 2 into destination object 'name' of size 2
  103 |   char name[2/* ... */];
      |        ^~~~
```

## Impact

fix ci break report here: https://github.com/apache/nuttx/actions/runs/7144096261/job/19457106837?pr=11301

## Testing

ci

@xiaoxiang781216
Copy link
Contributor Author

xiaoxiang781216 commented Dec 9, 2023

Please ignore the nxstyle warning:

/home/xiaoxiang/backup/os/nuttx/apps/interpreters/bas/bas_token.h:509:7: error: Mixed case identifier found

@xiaoxiang781216
Copy link
Contributor Author

ci break is fixed here: apache/nuttx#11357

@trns1997
Copy link

trns1997 commented Dec 9, 2023

@xiaoxiang781216 Could not find GN_EXECUTABLEXX using the following names: gn:

Cmake in present: sim/matter
Configuration/Tool: sim/matter
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
CMake Error at libs/libxx/libcxx.cmake:68 (find_program):
  Could not find GN_EXECUTABLEXX using the following names: gn
Call Stack (most recent call first):
  libs/libxx/CMakeLists.txt:34 (include)


CMake Error at libs/libxx/libcxx.cmake:68 (find_program):
  Could not find GN_EXECUTABLEXX using the following names: gn
Call Stack (most recent call first):
  libs/libxx/CMakeLists.txt:34 (include)


-- Configuring incomplete, errors occurred!
  Building NuttX...
ninja: error: loading 'build.ninja': No such file or directory
ninja: error: loading 'build.ninja': No such file or directory
ninja: error: loading 'build.ninja': No such file or directory
ninja: error: loading 'build.ninja': No such file or directory

I am guessing the docker image was not up to date when you ran the test

bas_token.l: In function 'yylex':
Error: bas_token.l:1210:31: error: 'strcpy' writing 1 or more bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
 1210 |                             }
      |                               ^
In file included from bas_auto.h:77,
                 from bas_token.l:16:
bas_token.h:103:8: note: at offset 2 into destination object 'name' of size 2
  103 |   char name[2/* ... */];
      |        ^~~~

Signed-off-by: Xiang Xiao <[email protected]>
@xiaoxiang781216
Copy link
Contributor Author

let's me restart the ci to see the result.

@@ -100,7 +100,7 @@ struct Identifier
{
struct Symbol *sym;
enum ValueType defaultType;
char name[2/* ... */];
char name[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

This is C89 incompatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, do you have better method?

Copy link
Contributor Author

@xiaoxiang781216 xiaoxiang781216 Dec 10, 2023

Choose a reason for hiding this comment

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

@pkarashchenko ci is broken now, it's better to merge this patch ASAP, and provide a better fix later.
Note: another ci error is fixed by apache/nuttx#11361.

Choose a reason for hiding this comment

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

Maybe encapsulate both in an #ifdef __STDC then c89 standard and char name[2] else char name[0]. I am not sure it will work, but if it does it should unblock the ci until we find a better long-term solution.

Copy link
Contributor Author

@xiaoxiang781216 xiaoxiang781216 Dec 10, 2023

Choose a reason for hiding this comment

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

@pkarashchenko please provide better method later, I have to merge this patch now to unblock ci.

@xiaoxiang781216 xiaoxiang781216 merged commit f28797c into apache:master Dec 10, 2023
10 of 25 checks passed
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.

3 participants