roberto@cernvax.UUCP (roberto bagnara) (01/25/90)
/*
** 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 */
}