"cannot convert to a pointer type" error repeated tens of times

2022-02-12 Thread Andrea Monaco via Gcc
Hello, I may have hit a bug while using libcurl, a common library for network operations, on gcc 8.3.0. Building this program #include int main (void) { float a; curl_easy_setopt (NULL, 0, (void *) a); } with "gcc -c bug.c" gives bug.c: In function ‘main’: bug.c

No type checking in ctype builtins

2022-04-27 Thread Andrea Monaco via Gcc
This program #include int main () { char *s; isspace (s); } compiles with no warning in gcc 8.3.0, even though there's a type mistake; the correct call would be isspace (*s). The ctype functions are implemented as macros in glibc, so you can't have type checking. But they ar

Re: No type checking in ctype builtins

2022-04-27 Thread Andrea Monaco via Gcc
> Try -Wsystem-headers. You're right. That showed a warning. > You need to suppress the macro to get the builtin. That means a macro expansion takes precedence over a builtin function substitution, if I understand correctly. It makes sense, because preprocessing happens before compilati

Buggy error message when dereferencing once a double pointer to struct

2022-05-23 Thread Andrea Monaco via Gcc
This snippet that I wrote struct str { int val; }; void main (int argc, char **argv) { struct str **p; int i; i = p->val; } is obviously incorrect. But gcc 8.3.0 says pointer.c: In function ‘main’: pointer.c:14:8: error: ‘*p’ is a pointer; did you

No warning about duplicate values in enum

2023-03-10 Thread Andrea Monaco via Gcc
In gcc 8.3.0, compiling enum test { FIRST = 1, SECOND = 1, THIRD = 2 }; int main (void) { return 0; } generates no warning even with -Wextra. That hit me today, because I had a large enum with many explicitly assigned constants and I accidentally used the same value twice,