This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/59598] very simple code using file open for read


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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #32 from Kai Tietz <ktietz at gcc dot gnu.org> ---
(In reply to Denis Kolesnik from comment #29)
> My code style has nothing to do with it. I even do not tell, that I do not
> fully like the interface of this site!!

Well, you coding-style and ability is poor.  Believe me. I wasn't referring to
those none-used arrays.

Think about this if-line in your second sample.  It contains the out of bounds
access:

...
        if((character_number >= word_begin_position[word_number]) &&
(character_number <= word_begin_position[word_number+1]) )
...

What is word_begin_position[word_number+1]???  Imagine you are within the final
word in your file.  The value at this position isn't initialized and therefore
contains random number.
Btw here in this line is also one of the logical failures you made.  Why your
if-condition includes first character of next word?

So you mights see, or I fear you won't, that your program has more then one bug
and therefore this is a invalid bug-report of gcc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]