Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a bug in CodeGuard ?

245 views
Skip to first unread message

Pauli Haukka

unread,
May 4, 2007, 9:36:52 AM5/4/07
to
CodeGuard gives me following errors messages:

4.5.2007 16:13:53 started a CodeGuard(tm) process: Laivanupotus.exe(1396)
Bad parameter in process: Laivanupotus.exe(1396) - f:\program
files\borland\bds\4.0\include\dinkumware\fstream#23
A bad file or pipe stream (0x3277D7A8) has been passed to the function.
0x0042B530 Call to fgetc(0x3277D7A8)
0x004224D6 - f:\program
files\borland\bds\4.0\include\dinkumware\fstream#23
0x0041E601 - f:\program
files\borland\bds\4.0\include\dinkumware\fstream#366
0x0041E4CD - f:\program
files\borland\bds\4.0\include\dinkumware\fstream#346
0x0041215A - f:\program
files\borland\bds\4.0\include\dinkumware\streambuf#103
0x00411C56 - f:\program
files\borland\bds\4.0\include\dinkumware\string#572
0x0040D861 - f:\program
files\borland\bds\4.0\include\dinkumware\string#612


And jumps this file:

// fstream standard header

template<> inline bool _Fgetc(char& _Byte, _Filet *_File)
{ // get a char element from a C stream
int _Meta;
if ((_Meta = fgetc(_File)) == EOF) // *** POINTS THIS LINE ***
return (false);
else
{ // got one, convert to char
_Byte = (char)_Meta;
return (true);
-----------------------------------------------------------------------

Error is caused by getline( tiedosto, pelaajannimi_ ) call in the code
below.
pelaajanimi_ is private string variable of class Pelaaja.

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
...
bool Pelaaja::lueTiedot()
{
ifstream tiedosto( laivatiedosto_.c_str() );
if( tiedosto ){
getline( tiedosto, pelaajannimi_ );
...

Do you have any idea what causes this error ?
I makes impossible to use CodeGuard for debugging.

~Pauli


Thomas Maeder [TeamB]

unread,
May 4, 2007, 12:24:27 PM5/4/07
to
"Pauli Haukka" <pauli....@tut.fi> writes:

SCNR: I love Finnish variable names; have you considered applying
rot13 to enhance their readability? :-)


> #include <iostream>
> #include <fstream>
> #include <sstream>
> #include <string>
> #include <vector>
> ...
> bool Pelaaja::lueTiedot()
> {
> ifstream tiedosto( laivatiedosto_.c_str() );
> if( tiedosto ){
> getline( tiedosto, pelaajannimi_ );
> ...
>
> Do you have any idea what causes this error ?

The only thing that comes to mind is the there is a nasty bug
somewhere else in your program that causes this. Or a CodeGuard bug,
but since CodeGuard has probably been tested by more people than your
code ...

Can you reproduce the problem if you reduce the program to a <50 line
main() function containing the code given above?

Bruce Salzman

unread,
May 4, 2007, 3:07:48 PM5/4/07
to

"Pauli Haukka" <pauli....@tut.fi> wrote in message
news:463b...@newsgroups.borland.com...

> CodeGuard gives me following errors messages:
>
> 4.5.2007 16:13:53 started a CodeGuard(tm) process:
> Laivanupotus.exe(1396)
> Bad parameter in process: Laivanupotus.exe(1396) - f:\program
> files\borland\bds\4.0\include\dinkumware\fstream#23
> A bad file or pipe stream (0x3277D7A8) has been passed to the
> function.
> 0x0042B530 Call to fgetc(0x3277D7A8)

I ran into that as well. Go to Tools|CodeGuard Configuration|Function
Options and uncheck Invalid handle/resource parameters for the _fgetc
function.

--
Bruce


Sergiy Kanilo

unread,
May 4, 2007, 3:42:10 PM5/4/07
to

"Thomas Maeder [TeamB]" <mae...@glue.ch> wrote in message
news:m2ejlwf...@glue.ch...

> The only thing that comes to mind is the there is a nasty bug
> somewhere else in your program that causes this. Or a CodeGuard bug,
> but since CodeGuard has probably been tested by more people than your
> code ...

> Can you reproduce the problem if you reduce the program to a <50 line
> main() function containing the code given above?

#include <fstream>
#include <string>
int main()
{
std::ifstream file( "test.txt" );
std::string line;
std::getline( file, line );
return 0;
}

causes

Bad parameter in process: Project1.exe(2224) - c:\program

files\borland\bds\4.0\include\dinkumware\fstream#23

A bad file or pipe stream (0x3279C0F8) has been passed to the function.
0x00409A98 Call to fgetc(0x3279C0F8)
0x004095C2 - c:\program

files\borland\bds\4.0\include\dinkumware\fstream#23

0x0040846D - c:\program

files\borland\bds\4.0\include\dinkumware\fstream#366

0x004037FA - c:\program
files\borland\bds\4.0\include\dinkumware\streambuf#97
0x00403662 - c:\program
files\borland\bds\4.0\include\dinkumware\streambuf#114
0x00402426 - c:\program
files\borland\bds\4.0\include\dinkumware\string#574
0x0040170D - c:\program

files\borland\bds\4.0\include\dinkumware\string#612

if you compile using BDS2006 with "All Codeguard options on'
Strange enough, but there are no codeguard messages if file does not exist.

Cheers,
Serge


Thomas Maeder [TeamB]

unread,
May 4, 2007, 4:36:16 PM5/4/07
to
"Sergiy Kanilo" <ska...@artannlabs.com> writes:

> "Thomas Maeder [TeamB]" <mae...@glue.ch> wrote in message
> news:m2ejlwf...@glue.ch...
>
>> The only thing that comes to mind is the there is a nasty bug
>> somewhere else in your program that causes this. Or a CodeGuard bug,
>> but since CodeGuard has probably been tested by more people than your
>> code ...
>
>> Can you reproduce the problem if you reduce the program to a <50 line
>> main() function containing the code given above?
>
> #include <fstream>
> #include <string>
> int main()
> {
> std::ifstream file( "test.txt" );
> std::string line;
> std::getline( file, line );
> return 0;
> }
>
> causes
>
> Bad parameter in process: Project1.exe(2224) - c:\program
> files\borland\bds\4.0\include\dinkumware\fstream#23
> A bad file or pipe stream (0x3279C0F8) has been passed to the function.
> 0x00409A98 Call to fgetc(0x3279C0F8)

Wow; I stand corrected. This is a good bug report for Quality Central,
if it's not already there.

David Dean [CodeGear]

unread,
May 4, 2007, 4:52:42 PM5/4/07
to
In article <463b...@newsgroups.borland.com>,
"Sergiy Kanilo" <ska...@artannlabs.com> wrote:

> #include <fstream>
> #include <string>
> int main()
> {
> std::ifstream file( "test.txt" );
> std::string line;
> std::getline( file, line );
> return 0;
> }
>
> causes
>
> Bad parameter in process: Project1.exe(2224) - c:\program
> files\borland\bds\4.0\include\dinkumware\fstream#23
> A bad file or pipe stream (0x3279C0F8) has been passed to the function.
> 0x00409A98 Call to fgetc(0x3279C0F8)
> 0x004095C2 - c:\program

Please enter this into QC.

--
-David Dean
CodeGear C++ QA Engineer
<http://blogs.codegear.com/ddean/>

0 new messages