-
Notifications
You must be signed in to change notification settings - Fork 14
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
Warnings in ArchLinux (GCC 10?) #42
Comments
Ok, looking at the code in void PrintArr(FILE *stream, int typeflag, string format, int dim, int * shp, void *a) {
...
if (dim == 0) {
// we do some stuff here
} else {
index = malloc (dim * sizeof (int));
// we do something with `index`
}
} If I use a cast to The source of the problem as far as I can see is that because we are calling An alternative solution is to perform some kind of check for |
When building the stdlib on ArchLinux (and presumably any system using GCC 10), we get the following warnings:
These warning seem to indicate that the input for
malloc
may exceed some upper limit, leading to invalid allocation.A quick look at GCC bug-report 85783 shows that this warning happens in cases where are compile-time can't determine if the input to
malloc
is sane. A suggested fix is to re-cast the input to something compatible withsize_t
, e.g.unsigned int
.The text was updated successfully, but these errors were encountered: