* "cannot convert to a pointer type" error repeated tens of times
@ 2022-02-12 20:32 Andrea Monaco
2022-02-12 20:55 ` Marc Glisse
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Monaco @ 2022-02-12 20:32 UTC (permalink / raw)
To: 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 <curl/curl.h>
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:15:3: error: cannot convert to a pointer type
curl_easy_setopt (NULL, 0, (void *) a);
^~~~~~~~~~~~~~~~
bug.c:15:3: error: cannot convert to a pointer type
bug.c:15:3: error: cannot convert to a pointer type
bug.c:15:3: error: cannot convert to a pointer type
[...]
bug.c:15:3: error: cannot convert to a pointer type
In file included from /usr/include/x86_64-linux-gnu/curl/curl.h:2826,
from bug.c:1:
bug.c:15:3: error: cannot convert to a pointer type
curl_easy_setopt (NULL, 0, (void *) a);
^~~~~~~~~~~~~~~~
bug.c:15:3: error: cannot convert to a pointer type
curl_easy_setopt (NULL, 0, (void *) a);
^~~~~~~~~~~~~~~~
bug.c:15:3: error: cannot convert to a pointer type
curl_easy_setopt (NULL, 0, (void *) a);
^~~~~~~~~~~~~~~~
The error message is correct, but is repeated tens of times.
The function is declared this way in curl.h
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option,
...);
but I couldn't replicate the bug by copying that line only.
Thanks,
Andrea Monaco
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: "cannot convert to a pointer type" error repeated tens of times
2022-02-12 20:32 "cannot convert to a pointer type" error repeated tens of times Andrea Monaco
@ 2022-02-12 20:55 ` Marc Glisse
0 siblings, 0 replies; 2+ messages in thread
From: Marc Glisse @ 2022-02-12 20:55 UTC (permalink / raw)
To: Andrea Monaco; +Cc: gcc
On Sat, 12 Feb 2022, Andrea Monaco via Gcc wrote:
> #include <curl/curl.h>
>
> 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:15:3: error: cannot convert to a pointer type
> curl_easy_setopt (NULL, 0, (void *) a);
> ^~~~~~~~~~~~~~~~
> bug.c:15:3: error: cannot convert to a pointer type
> bug.c:15:3: error: cannot convert to a pointer type
> bug.c:15:3: error: cannot convert to a pointer type
> [...]
> bug.c:15:3: error: cannot convert to a pointer type
> In file included from /usr/include/x86_64-linux-gnu/curl/curl.h:2826,
> from bug.c:1:
> bug.c:15:3: error: cannot convert to a pointer type
> curl_easy_setopt (NULL, 0, (void *) a);
> ^~~~~~~~~~~~~~~~
> bug.c:15:3: error: cannot convert to a pointer type
> curl_easy_setopt (NULL, 0, (void *) a);
> ^~~~~~~~~~~~~~~~
> bug.c:15:3: error: cannot convert to a pointer type
> curl_easy_setopt (NULL, 0, (void *) a);
> ^~~~~~~~~~~~~~~~
>
>
> The error message is correct, but is repeated tens of times.
> The function is declared this way in curl.h
>
> CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option,
> ...);
No, curl_easy_setopt is a macro. If you look at the preprocessed code, you
get many statements doing the same wrong operation, and one warning for
each of them.
(wrong list, should be gcc-help, or an issue on bugzilla)
--
Marc Glisse
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-12 20:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-12 20:32 "cannot convert to a pointer type" error repeated tens of times Andrea Monaco
2022-02-12 20:55 ` Marc Glisse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).