public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50757] New: Cannot turn off -Wnonnull when using C++
@ 2011-10-17 12:10 roman.fietze at telemotive dot de
  2011-10-17 12:25 ` [Bug c++/50757] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: roman.fietze at telemotive dot de @ 2011-10-17 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50757
           Summary: Cannot turn off -Wnonnull when using C++
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roman.fietze@telemotive.de


When using gcc e.g. in embedded systems it can happen that valid memory regions
start at address 0x0. E.g. in our System a huge DDR2 starts at 0x0, and we
cannot move it easily or even reserve page 0.

Although it is almost impossible, that the start address of a format string
will be at address 0, there's still the possibility, that this is "normal"
memory that has to be used by the application, e.g as a buffer.

Therefore it might happen that one wants to write something like

  memset(myptr, 0, mysize);

or

  memcpy(myptr, mydata, datasize);

with myptr beeing 0, or even worse, constant 0 (char * const myptr = 0x0;)

Trying to turn -Wnonnull off (which is being turned on automatically using
-Wall/-Wformat) using e.g. this command line

  g++-4.6  -Wall [-Werror] -Wno-nonnull ...

causes an error

  cc1plus: warning: command line option ‘-Wno-nonnull’ is valid for C/ObjC but
not for C++ ...

If it is allowed to implicitly turn on -Wnonnull it must also be allowed to
turn it off again. Even in C++.


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

end of thread, other threads:[~2011-10-17 17:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-17 12:10 [Bug c++/50757] New: Cannot turn off -Wnonnull when using C++ roman.fietze at telemotive dot de
2011-10-17 12:25 ` [Bug c++/50757] " redi at gcc dot gnu.org
2011-10-17 12:34 ` redi at gcc dot gnu.org
2011-10-17 12:43 ` paolo.carlini at oracle dot com
2011-10-17 17:45 ` paolo at gcc dot gnu.org
2011-10-17 17:47 ` paolo.carlini at oracle dot com
2011-10-17 17:49 ` paolo at gcc dot gnu.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).