public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5546: Bad "const" verification
@ 2002-04-26 9:06 nathan
0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-04-26 9:06 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, jbach1, nobody
Synopsis: Bad "const" verification
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Fri Apr 26 09:06:57 2002
State-Changed-Why:
you need to add -W, and then it says,
nathan@manao:171>g++ -c 5546.cc
5546.cc: In function `int main(int, char**)':
5546.cc:8: warning: deprecated conversion from string constant to `char*'
note, you've attempted to modify a constant object, and
therefore entered undefined teritory.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5546
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/5546: Bad "const" verification
@ 2002-01-30 15:26 jbach1
0 siblings, 0 replies; 2+ messages in thread
From: jbach1 @ 2002-01-30 15:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 5546
>Category: c++
>Synopsis: Bad "const" verification
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Wed Jan 30 15:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Pierre Chatelier
>Release: gcc 3.0.3
>Organization:
>Environment:
DOS (DJGPP)
>Description:
A const string (type char*, not string from <string>) can
be overwritten by strcpy
>How-To-Repeat:
#include <cstring>
#include <iostream>
using namespace std;
int main(int, char* [])
{
cout << "Hello" << endl;
strcpy("Hello", "World");
cout << "Hello" << endl;
return 0;
}
compiled with `gxx -Wall -ansi -pedantic`
no warnings appear during compilation
the result on screen is
Hello
World
Terrific, isn't it ?
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-04-26 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26 9:06 c++/5546: Bad "const" verification nathan
-- strict thread matches above, loose matches on Subject: below --
2002-01-30 15:26 jbach1
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).