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

array bounds warning with gcc-11 #87

Open
roblatham00 opened this issue Nov 30, 2021 · 1 comment
Open

array bounds warning with gcc-11 #87

roblatham00 opened this issue Nov 30, 2021 · 1 comment

Comments

@roblatham00
Copy link

When I build tinyexpr with gcc-11 I get warnings about array subscripts exceeding bounds:

%   gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
gcc -Wall -Wshadow -O2 -o smoke smoke.c tinyexpr.c -lm
tinyexpr.c: In function ‘base’:
tinyexpr.c:321:16: warning: array subscript ‘te_expr[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Warray-bounds]
  321 |             ret->bound = s->bound;
      |                ^~
tinyexpr.c:90:20: note: referencing an object of size 16 allocated by ‘malloc’
   90 |     te_expr *ret = malloc(size);
      |                    ^~~~~~~~~~~~

Reproducing is easy: I checked out tinyexpr from github and typed "make"

@KonstiDE
Copy link

KonstiDE commented Aug 26, 2024

PR #88 solves it, thanks @roblatham00

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

No branches or pull requests

2 participants