This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/33859] New: Bogus "discards qualifiers" warning


static void foo (char *s) { }
void bar (const char *s) { foo ((char *)s); }

gcc 4.2.0 produces this warning with -Wall -O2:
www.c:2: warning: passing argument 1 of `foo' discards qualifiers from pointer
target type.

Due to the cast, the argument already has the right type, so gcc should not
warn.
The warning disappears without -O2.
gcc 4.1.1 did not produce this warning.


-- 
           Summary: Bogus "discards qualifiers" warning
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: terra at gnome dot org
  GCC host triplet: i686-suse-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]