This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: target/3750: stream input operator>> fails in g++ 3.0
- To: "'ljrittle at gcc dot gnu dot org'" <ljrittle at gcc dot gnu dot org>, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jddahl <jddahl at micron dot com>, nobody at gcc dot gnu dot org
- Subject: RE: target/3750: stream input operator>> fails in g++ 3.0
- From: jddahl <jddahl at micron dot com>
- Date: Fri, 10 Aug 2001 08:26:07 -0600
I have recently upgraded to solaris2.7 and get the same garbled output. The
program:
#include <iostream>
#include <string>
#include <fstream>
using std::string;
using std::cerr;
using std::cout;
using std::endl;
using std::ifstream;
using std::ios;
int main( int argc, char *argv[] )
{
string fileArg;
ifstream inFile( "/u/jddahl/HelloWorld.java", ios::in );
if( !inFile )
{
cerr << "File could not be opened" << endl;
}
while( inFile >> fileArg )
{
cout << "[" << fileArg << "]" << endl;
}
return 0;
}
when parsing this file:
// /u/jddahl/HelloWorld.java
public class HelloWorld
{
public static void main(String [] args)
{
System.out.println("Hello");
}
}
compiled with g++ 3.0 in a new directory outputs the following:
[public class Hello]
[orld
{
public static void main(]
[tring ]
[] args)
{
]
[ystem.out.println("Hello");
}
}
]
But when I compile with 2.95.x, I get the following correct output:
[public]
[class]
[HelloWorld]
[{]
[public]
[static]
[void]
[main(String]
[[]]
[args)]
[{]
[System.out.println("Hello");]
[}]
[}]
Thanks,
Jeff Dahl
> -----Original Message-----
> From: ljrittle@gcc.gnu.org [mailto:ljrittle@gcc.gnu.org]
> Sent: Monday, July 30, 2001 3:27 PM
> To: gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org; jddahl@micron.com;
> ljrittle@gcc.gnu.org; nobody@gcc.gnu.org
> Subject: Re: target/3750: stream input operator>> fails in g++ 3.0
>
>
> Synopsis: stream input operator>> fails in g++ 3.0
>
> Responsible-Changed-From-To: ljrittle->unassigned
> Responsible-Changed-By: ljrittle
> Responsible-Changed-When: Mon Jul 30 14:27:23 2001
> Responsible-Changed-Why:
> Can not reproduce PR in my solaris2.7 environment. The
> preprocessed code looks as expected verses what I obtain
> under gcc 3.0 on solaris2.7. I have to compile the 2.6
> preprocessed code with -static -frepo or else I see
> undefined symbols and/or a core dump (but that is
> for reasons unrelated to the problem encountered
> by the PR submitter).
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3750&database=gcc
>