public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rogi at skylittlesystem dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/98945] New: gcc does not warn when assigning value of type int (*)() to variable of type int (*)(double) Date: Tue, 02 Feb 2021 23:24:42 +0000 [thread overview] Message-ID: <bug-98945-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98945 Bug ID: 98945 Summary: gcc does not warn when assigning value of type int (*)() to variable of type int (*)(double) Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rogi at skylittlesystem dot org Target Milestone: --- gcc complains about assigning a value of type `int (*)()` to a variable of type `int (*)(float)`, but not for a variable of type `int (*)(double)`, which I thought to be a minor bug. First observed on version 9.3.0, and also after updating 10.2.1, both give the same result. Here's a small test case: ``` $ gcc -O0 -Wall -o a.out -xc - <<EOF int f() { return 0; } int main() { int (*p_float)(float f) = f; int (*p_double)(double d) = f; return 0; } EOF <stdin>: In function 'main': <stdin>:8:35: warning: initialization of 'int (*)(float)' from incompatible pointer type 'int (*)()' [-Wincompatible-pointer-types] <stdin>:9:15: warning: unused variable 'p_double' [-Wunused-variable] <stdin>:8:15: warning: unused variable 'p_float' [-Wunused-variable] ``` thanks <3
next reply other threads:[~2021-02-02 23:24 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-02 23:24 rogi at skylittlesystem dot org [this message] 2021-02-03 0:45 ` [Bug c/98945] " msebor at gcc dot gnu.org 2021-02-03 7:39 ` rguenth at gcc dot gnu.org 2021-02-03 21:31 ` joseph at codesourcery dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-98945-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).