Article View: gnu.gcc.bug
Article #916Possibly wrong warnings about passing const and volatile pointers
From: roberto bagnara
Date: Wed, 24 Jan 1990 16:17
Date: Wed, 24 Jan 1990 16:17
68 lines
2067 bytes
2067 bytes
/*
** Compiler: GNU CC
** Version: 1.36
** System: Motorola 3300 Delta Series running sysV68 R3.5
** File: const.c
** Command: gcc -c const.c
** Problem: Possibly wrong warnings about passing const
** and volatile pointers
** Reporter: Roberto Bagnara, CS Department, PISA University
**
** Discaimer: I haven't the ANSI C specifications at hand.
*/
/* Try this to see what happens with volatile */
#if 0
#define const volatile
#endif
typedef int **ipp;
typedef const int **cipp;
typedef int * const *ipcp;
typedef const int * const *cipcp;
void fipp(ipp a);
void fcipp(cipp a);
void fipcp(ipcp a);
void fcipcp(cipcp a);
/* Wrong warning ==
`warning: argument passing between incompatible pointer types'
instead of
`warning: argument passing of non-const * pointer from const *'
*/
/* Spurious warning ==
`warning: argument passing between incompatible pointer types'
given when there is nothing to complain
*/
main()
{
ipp ippv;
cipp cippv;
ipcp ipcpv;
cipcp cipcpv;
fipp(ippv); /* Legal */
fipp(cippv); /* Illegal */ /* Wrong warning */
fipp(ipcpv); /* Illegal */
fipp(cipcpv); /* Illegal */ /* Wrong warning */
fcipp(ippv); /* Legal */ /* Spurious warning */
fcipp(cippv); /* Legal */
fcipp(ipcpv); /* Illegal */ /* Wrong warning */
fcipp(cipcpv); /* Illegal */
fipcp(ippv); /* Legal */
fipcp(cippv); /* Illegal */ /* Wrong warning */
fipcp(ipcpv); /* Legal */
fipcp(cipcpv); /* Illegal */ /* Wrong warning */
fcipcp(ippv); /* Legal */ /* Spurious warning */
fcipcp(cippv); /* Legal */
fcipcp(ipcpv); /* Legal */ /* Spurious warning */
fcipcp(cipcpv); /* Legal */
}
Technical Details
Message-ID:
<1220@cernvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!cernvax!robertoShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!cernvax!roberto From: roberto@cernvax.UUCP (roberto bagnara) Newsgroups: gnu.gcc.bug Subject: Possibly wrong warnings about passing const and volatile pointers Keywords: const, volatile, warnings Message-ID: <1220@cernvax.UUCP> Date: 24 Jan 90 16:17:55 GMT Organization: CERN, Geneva, Switzerland Lines: 68