This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16396] New: cout of volatile char * prints funny
- From: "ramsdell at mitre dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2004 23:25:49 -0000
- Subject: [Bug c++/16396] New: cout of volatile char * prints funny
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Are volatile C strings printed in C++ by special rules? I get 1 no matter
what is in the string. See the comments at the end of the following C++ program.
$ cat vcp.cc
#include <cstdio>
#include <iostream>
int main(int argc, char **argv)
{
volatile char str[] = { 'a', 'b', '\0' };
std::printf("%s\n", str);
std::cout << str << "\n";
return 0;
}
/*
* $ uname -a
* Linux localhost.localdomain 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686
i686 i386 GNU/Linux
* $ gcc --version
* gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
* Copyright (C) 2003 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.
*
* $ make vcp
* g++ vcp.cc -o vcp
* $ ./vcp
* ab
* 1
* $
*/
$
--
Summary: cout of volatile char * prints funny
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ramsdell at mitre dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16396