This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/41142] make implicit pointer conversions an error when sizeof(int) != sizeof(void *)
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 07 Feb 2017 23:10:51 +0000
- Subject: [Bug c/41142] make implicit pointer conversions an error when sizeof(int) != sizeof(void *)
- Auto-submitted: auto-generated
- References: <bug-41142-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41142
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2017-02-07
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
There has been no update on this request in over 7 years. Is it still relevant
(especially in light of comment #1)? If so, can you provide more details?
I.e., what warnings specifically would you like to treat as errors that
-Werror=warning-name doesn't let you do? Like so:
$ cat t.c && /build/gcc-git/gcc/xgcc -B /build/gcc-git/gcc -O0 -S -Wall
-Werror=int-conversion t.c
int f (void*);
void* g (void)
{
char *s = f (0);
f (123);
s = 345;
return 456;
}
t.c: In function ‘g’:
t.c:4:13: error: initialization makes pointer from integer without a cast
[-Werror=int-conversion]
char *s = f (0);
^
t.c:5:6: error: passing argument 1 of ‘f’ makes pointer from integer without a
cast [-Werror=int-conversion]
f (123);
^~~
t.c:1:5: note: expected ‘void *’ but argument is of type ‘int’
int f (void*);
^
t.c:6:5: error: assignment makes pointer from integer without a cast
[-Werror=int-conversion]
s = 345;
^
t.c:7:10: error: return makes pointer from integer without a cast
[-Werror=int-conversion]
return 456;
^~~
t.c:4:9: warning: variable ‘s’ set but not used [-Wunused-but-set-variable]
char *s = f (0);
^
cc1: some warnings being treated as errors