public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14313] New: gcc i486: fail to warn of inconsistent prototype: const char * const vs. const char *
@ 2004-02-27  1:06 wje at acm dot org
  2004-02-27  2:53 ` [Bug c/14313] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: wje at acm dot org @ 2004-02-27  1:06 UTC (permalink / raw)
  To: gcc-bugs

Error/warning message: none (that's the problem).

=== beginning of source (13 lines)
int STRCMP(const char * const alpha, const char * const beta );
int STRCMP(const char *       alpha, const char *       beta )
{
  while(*alpha==*beta)
  {
    if(*alpha=='\0') return 0;

    alpha++; beta ++;
  }
  return (*alpha)-(*beta);
}

int main(void) { return (STRCMP("gamma","delta")!=0); }
=== end of source
=== beginning of simple run (15 lines)
Script started on Thu Feb 26 16:45:21 2004
bill:~/cbug$ gcc --version
gcc (GCC) 3.2.3
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bill:~/cbug$ gcc -Wall cbug.c -o cbug
bill:~/cbug$ echo $?
0
bill:~/cbug$ ./cbug
bill:~/cbug$ echo $?
1
bill:~/cbug$ exit
Script done on Thu Feb 26 16:45:42 2004
=== end of simple run
=== beginning of gnu-recommended run (29 lines before folding)
Script started on Thu Feb 26 16:50:52 2004
bill:~/cbug$ gcc -v -save-temps -Wall cbug.c -o cbug
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/specs
Configured with: ../gcc-3.2.3/configure --prefix=/usr --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld
--verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.2.3
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/cpp0 -lang-c -v -D__GNUC__=3
-D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102 -D__ELF__
-Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__
-D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386
-Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i486__ cbug.c -Wall cbug.i
GNU CPP version 3.2.3 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i486-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/cc1 -fpreprocessed cbug.i -quiet
-dumpbase cbug.c -Wall -version -o cbug.s
GNU CPP version 3.2.3 (cpplib) (i386 Linux/ELF)
GNU C version 3.2.3 (i486-slackware-linux)
        compiled by GNU C version 3.2.3.
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../../i486-slackware-linux/bin/as -V -Qy -o cbug.o cbug.s
GNU assembler version 2.14.90.0.6 (i486-slackware-linux) using BFD version
2.14.90.0.6 20030820
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o cbug
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../crt1.o
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../crti.o
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/crtbegin.o
-L/usr/lib/gcc-lib/i486-slackware-linux/3.2.3
-L/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../../i486-slackware-linux/lib
-L/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../.. cbug.o -lgcc -lgcc_eh -lc
-lgcc -lgcc_eh /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/crtend.o
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../crtn.o
bill:~/cbug$ echo $?
0
bill:~/cbug$ ./cbug
bill:~/cbug$ echo $?
1
bill:~/cbug$ exit
Script done on Thu Feb 26 16:52:21 2004
=== end of gnu-recommended run
=== beginning of cbug.i (17 lines)
# 1 "cbug.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "cbug.c"
int STRCMP(const char * const alpha, const char * const beta );
int STRCMP(const char * alpha, const char * beta )
{
  while(*alpha==*beta)
  {
    if(*alpha=='\0') return 0;

    alpha++; beta ++;
  }
  return (*alpha)-(*beta);
}

int main(void) { return (STRCMP("gamma","delta")!=0); }
=== end of cbug.i

-- 
           Summary: gcc i486: fail to warn of inconsistent prototype: const
                    char * const vs. const char *
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wje at acm dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14313


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/14313] fail to warn of inconsistent prototype: const char * const vs. const char *
  2004-02-27  1:06 [Bug c/14313] New: gcc i486: fail to warn of inconsistent prototype: const char * const vs. const char * wje at acm dot org
@ 2004-02-27  2:53 ` pinskia at gcc dot gnu dot org
  2004-02-27  8:20 ` rth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-27  2:53 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
            Summary|gcc i486: fail to warn of   |fail to warn of inconsistent
                   |inconsistent prototype:     |prototype: const char *
                   |const char * const vs. const|const vs. const char *
                   |char *                      |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14313


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/14313] fail to warn of inconsistent prototype: const char * const vs. const char *
  2004-02-27  1:06 [Bug c/14313] New: gcc i486: fail to warn of inconsistent prototype: const char * const vs. const char * wje at acm dot org
  2004-02-27  2:53 ` [Bug c/14313] " pinskia at gcc dot gnu dot org
@ 2004-02-27  8:20 ` rth at gcc dot gnu dot org
  2004-02-27 14:09 ` wje at acm dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-02-27  8:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-02-27 08:20 -------
Not a bug.  6.7.5.3/15: "... corresponding parameters shall have compatible
types ...", and indeed they are.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14313


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/14313] fail to warn of inconsistent prototype: const char * const vs. const char *
  2004-02-27  1:06 [Bug c/14313] New: gcc i486: fail to warn of inconsistent prototype: const char * const vs. const char * wje at acm dot org
  2004-02-27  2:53 ` [Bug c/14313] " pinskia at gcc dot gnu dot org
  2004-02-27  8:20 ` rth at gcc dot gnu dot org
@ 2004-02-27 14:09 ` wje at acm dot org
  2004-02-27 14:19 ` jsm at polyomino dot org dot uk
  2004-02-27 15:29 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: wje at acm dot org @ 2004-02-27 14:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wje at acm dot org  2004-02-27 14:09 -------
To illustrate that there may yet be a problem, I invoke
6.7.3/9 ...

"For two qualified types to be compatible, both shall have
the identically qualified version of a compatible type."

... and present the following silly modification to the
program, which still compiles without warning, even with
-Wall:

=== beginning of silly program
int CHRCMP(const char alpha, const char beta );
int CHRCMP(      char alpha,       char beta )
{
  while(alpha==beta)
  {
    if(alpha=='\0') return 0;

    alpha++; beta++;
  }
  return (alpha)-(beta);
}

int main(void) { return (CHRCMP('g','d')!=0); }
=== end of silly program
=== beginning of cbug1.i
# 1 "cbug1.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "cbug1.c"
int CHRCMP(const char alpha, const char beta );
int CHRCMP( char alpha, char beta )
{
  while(alpha==beta)
  {
    if(alpha=='\0') return 0;

    alpha++; beta++;
  }
  return (alpha)-(beta);
}

int main(void) { return (CHRCMP('g','d')!=0); }
=== end of cbug1.i
=== beginning of gcc -v -save-temps -Wall gbug1.c -o gbug1
Script started on Fri Feb 27 05:47:56 2004
bill:~/cbug$ gcc -v -save-temps -Wall cbug1.c -o cbug1
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/specs
Configured with: ../gcc-3.2.3/configure --prefix=/usr --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld
--verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.2.3
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/cpp0 -lang-c -v -D__GNUC__=3
-D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102 -D__ELF__
-Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__
-D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386
-Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i486__ cbug1.c -Wall cbug1.i
GNU CPP version 3.2.3 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i486-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/cc1 -fpreprocessed cbug1.i -quiet
-dumpbase cbug1.c -Wall -version -o cbug1.s
GNU CPP version 3.2.3 (cpplib) (i386 Linux/ELF)
GNU C version 3.2.3 (i486-slackware-linux)
        compiled by GNU C version 3.2.3.
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../../i486-slackware-linux/bin/as -V -Qy -o cbug1.o cbug1.s
GNU assembler version 2.14.90.0.6 (i486-slackware-linux) using BFD version
2.14.90.0.6 20030820
 /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o cbug1
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../crt1.o
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../crti.o
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/crtbegin.o
-L/usr/lib/gcc-lib/i486-slackware-linux/3.2.3
-L/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../../i486-slackware-linux/lib
-L/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../.. cbug1.o -lgcc -lgcc_eh
-lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/crtend.o
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../crtn.o
bill:~/cbug$ echo $?
0
bill:~/cbug$ ./cbug1
bill:~/cbug$ echo $?
1
bill:~/cbug$ exit
Script done on Fri Feb 27 05:48:34 2004
=== end of gcc -v -save-temps -Wall gbug1.c -o gbug1

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14313


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/14313] fail to warn of inconsistent prototype: const char * const vs. const char *
  2004-02-27  1:06 [Bug c/14313] New: gcc i486: fail to warn of inconsistent prototype: const char * const vs. const char * wje at acm dot org
                   ` (2 preceding siblings ...)
  2004-02-27 14:09 ` wje at acm dot org
@ 2004-02-27 14:19 ` jsm at polyomino dot org dot uk
  2004-02-27 15:29 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-02-27 14:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-02-27 14:19 -------
Subject: Re:  fail to warn of inconsistent prototype: const char
 * const vs. const char *

On Fri, 27 Feb 2004, rth at gcc dot gnu dot org wrote:

> Not a bug.  6.7.5.3/15: "... corresponding parameters shall have compatible
> types ...", and indeed they are.

The relevant sentence is actually the last one of that paragraph ("... and 
each parameter declared with qualified type is taken as having the 
unqualified version of its declared type").



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14313


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/14313] fail to warn of inconsistent prototype: const char * const vs. const char *
  2004-02-27  1:06 [Bug c/14313] New: gcc i486: fail to warn of inconsistent prototype: const char * const vs. const char * wje at acm dot org
                   ` (3 preceding siblings ...)
  2004-02-27 14:19 ` jsm at polyomino dot org dot uk
@ 2004-02-27 15:29 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-02-27 15:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-02-27 15:29 -------
This is even a duplicate of an old PR I filed many years ago (and 
can't find any more :-( ). JSM and RTH are certainly right. 
 
W.  

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14313


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-02-27 15:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-27  1:06 [Bug c/14313] New: gcc i486: fail to warn of inconsistent prototype: const char * const vs. const char * wje at acm dot org
2004-02-27  2:53 ` [Bug c/14313] " pinskia at gcc dot gnu dot org
2004-02-27  8:20 ` rth at gcc dot gnu dot org
2004-02-27 14:09 ` wje at acm dot org
2004-02-27 14:19 ` jsm at polyomino dot org dot uk
2004-02-27 15:29 ` bangerth at dealii dot org

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).